文档详情

C语言例子(国外英文资料).doc

发布:2017-06-08约6.52千字共29页下载文档
文本预览下载声明
C语言例子(国外英文资料) # include stdio . h # include math.h int main() { 双a,b,c,d,e; scanf(“%低频%低频%低频%低频”,和,魅,明目的功效,研发); e =√战俘(a - c,2)+战俘(罪犯,2)); printf( % f \ n”,e); } # include stdio . h # include math.h int main() { 双r,v; scanf(“%低频”,设计验证); v = 4 * 3.14 *战俘(r,3)/ 3; printf( % .3f \ n”,v); } 先驱1 # include stdio . h # include math.h int main() { 双a、b; scanf(“%低频”等); 如果( 0) printf(“数量错误!”); 其他的 { b = sqrt(a); printf( % f”,b); } 返回0; } 先驱2 # include stdio . h # include math.h int main() { 双x,y; scanf(“%低频”,x); 如果(x = 0 x = 8) { y = x + 2 *战俘(x,2)+ 10; printf( % f”,y);} 其他{ y = 3 *战俘(x,3)9; printf( % f”,y);} 返回0; } P94 4 # include stdio . h # include math.h int main() { 双a,b,c scanf(“%低频%低频”等,福利); 如果( = 0,b = 0)c =战俘(a,2)+战俘(b,2); else if(b 0, 0)c =战俘(a,2)战俘(b,2); else if(b = 0, 0)c = a + b; else if(b 0 = 0)c = a - b; printf( % f、c); 返回0; } 判断输入字符 # include stdio . h int main() { 字符; scanf(“% c”等); 如果( 47个 58)printf(数字”); else if(一个 64 64)printf(大写字母”); else if(一个 96 96)printf(小写字母”); elseprintf(“其他符号”); 返回0; } 判断闰年 # include stdio . h int main() { int x; scanf(“% d”,x); if(x % 4 = = 0 x % 400 = = 0)printf(是闰年”); else if(x % 4 = = 0 x % 100 ! = 0)printf(是闰年”); 其他printf(不是闰年”); 返回0; } # include stdio . h int main() { int x; scanf(“% d”,x); if(x % 4 = = 0 x % 400 = = 0){ printf( % d”,x);printf(是闰年”);} else if(x % 4 = = 0 x % 100 ! = 0){ printf( % d”,x);printf(是闰年”);} 其他{ printf( % d”,x);printf(不是闰年”);} 返回0; } P94-9 # include stdio . h # include math.h int main() { int a、b; scanf(“% d”等); b = 0; 虽然( 0) { b = b + 10(%); 一个= 10 /; } printf( % d”,b); 返回0; } 好的 P94-14 # include stdio . h # include math.h int main() { int a,b,c,d,e; (= 100,e = 100,b = 0,c = 0,d = 0; 1000;+ +) { b = % 10;a = 10 /;c = % 10;一个= 10 /;d = % 10; 如果(e = =战俘(b,3)+战俘(c,3)+战俘(d,3)printf( % 5 d,e) 其他的; } } P94-15 # include stdio . h # include math.h int main() {双a、b; (a = 1,b = 0; 41;+ +) b = b +战俘(1 + 1)*(1 /); printf( %低频”,b); 返回0; } 好的 P94-16 # include stdio .
显示全部
相似文档