#include<stdio.h> int main() { int c1,c2,c3,c4; scanf("%d%d",&c1,&c2); printf("%d ",c1+c2); getchar(); c3=getchar(); c4=getchar(); printf("%d ",c3+c4); return 0; }
#include<stdio.h> int main() { char c1,c2,c3,c4; scanf("%c%c",&c1,&c2); printf("%c%c ",c1,c2); getchar(); c3=getchar(); c4=getchar(); printf("%c %c ",c3,c4); printf("%c %c %c %c ",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 ",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: "); scanf("%lf%lf",&r,&h); if((r<=0)||(h<=0)){ printf("输入错误,重新输入"); } else{ v=cylinder(r,h); printf("V=%.3f ",v); } } return 0; } double cylinder(double r,double h) { double result; result=3.1415926*r*r*h; return result; }