改错题详解.ppt

程序cmody032.c的功能是:输出201~300之间的所有素数,统计总个数 #include stdio.h #include math.h void main( ) { int num; printf(“\n”); num=fun( ); printf(“\n The total of prime is %d”, num); getch( ); } int fun() { int m, i, k, n=0; for(m=201; m=300; m+=2) * 1.程序cmody011.c的功能是:从字符数组str1中取出ASCII码为偶数且下标为偶数的字符依次存放到字符串t中。 例如, 若str1所指的字符串为:4AZ18c?Ge9a0z! 则t所指的字符串为:4Z8z 注意:数组下标从0开始。 #include math.h #include stdio.h #include string.h #include conio.h void main( ) { char str1[100], t[100]; int i, j; /**/i=0; /**/ clrscr( ); strcpy(str1, “4AZ18c?Ge9a0z!”); for(i=0; istrlen(str1); i++) { /**/if ((str1[i]%2=

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档