1.
#include<stdio.h>
int main()
{
printf("Hello World");
return 0;
}
2.
#include<stdio.h>
int main()
{
int a=1;
float b=2.5;
char c='A';
printf("a=%d\n",a);
printf("b=%f\n",b);
printf("c=%c\n",c);
printf("End of program\n");
}
3.
#include <stdio.h>
main()
{
printf("Data type Number of bytes\n");
printf("------------ ---------------------\n");
printf("char %d\n",sizeof(char));
printf("int %d\n",sizeof(int));
printf("short int %d\n",sizeof(short));
printf("long int %d\n",sizeof(long));
printf("float %d\n",sizeof(float));
printf("double %d\n",sizeof(double));
}
4.
#include<stdio.h>
int main()
{
double temC, temF;
temF=100;
temC=5*(temF-32)/9;
printf("华氏温度%5.2f对应的摄氏温度是%5.2f\n",temF,temC);
return 0;
}
5.
#include<stdio.h>
int main()
{
int a=6,b=5,c=5;
int triC;
triC=a+b+c;
printf("三角形的周长是:%d\n",triC);
return 0;
}
6
short是占两个字节的,最大值+1溢出变最小值
7
#include<stdio.h>
int main()
{
int a=-30,b=3,c=21,d=6,e=30,f=4;
int triA,triB,triC,triD;
triA=a*b+c/d,triB=a+b*c/d,triC=e/b*c%d,triD=a/b*c%f;
printf("1值是:%d\n",triA),printf("2值是:%d\n",triB);
printf("3值是:%d\n",triC),printf("4值是:%d\n",triD);
return 0;
}
8
i是否与j相等,且小于k
9
a d=3.000000 i=3 b d=3.500000 i=3
11
a有 b无 c无 d有