#include<stdio.h> int main() { int c1,c2,c3,c4; scanf("%d%d",&c1,&c2); printf("%d\n",c1+c2); getchar(); c3=getchar(); c4=getchar(); printf("%d\n",c3+c4); return 0; }
#include<stdio.h> int main() { char c1,c2,c3,c4; scanf("%c%c",&c1,&c2); printf("%c%c\n",c1,c2); getchar(); c3=getchar(); c4=getchar(); printf("%c %c\n",c3,c4); printf("%c %c %c %c\n",c1,c2,c3,c4); return 0; }
#include<stdio.h> int main() { float R,S; printf("Enter R:"); scanf("%f",&R); if(R>0){ S=R*R*3.14; printf("S=%f\n",S); } else printf("输入错误"); return 0; }
#include<stdio.h> int main() { int i,n; double r,v,h; double cylinder(double r,double h); printf("enter n:"); scanf("%d",&n); for(i=1;i<=n;i++){ printf("Enter r and h:\n"); scanf("%lf%lf",&r,&h); if((r<=0)||(h<=0)){ printf("输入错误,重新输入"); } else{ v=cylinder(r,h); printf("V=%.3f\n",v); } } return 0; } double cylinder(double r,double h) { double result; result=3.1415926*r*r*h; return result; }