c语言实验一
一:
#include "stdio.h" int main () { int a,b,sum; a = 123; b = 456; sum = a + b; printf("sum is %d\n",sum); return 0; }
二:1:
#include<stdio.h> int main() { char c1,c2; c1=97; c2=98; printf("c1=%c,c2=%c\n",c1,c2); printf("c1=%d,c2=%d\n",c1,c2); return 0; }
2:
#include<stdio.h> int main() { char c1,c2; c1=197; c2=198; printf("c1=%c,c2=%c\n",c1,c2); printf("c1=%d,c2=%d\n",c1,c2); return 0; }
三:
#include<stdio.h> #include<math.h> int main() { int x,y; double z,a; scanf("%d%d",&x,&y); z=(double)x+1/fabs((double)y); a=z; printf("%d\n",(int)z); printf("%.6lf\n",a); printf("%e\n",a); return 0; }