2020-10-09 21:58:00
#include <stdio.h>int main(){ int i,j; int a[3][3]; for(i=0;i<3;i++){ for(j=0;j<3;j++){ printf("a[%d][%d]=",i,j); scanf("%d",&a[i][j]); } } printf("请输出二维数组:\n"); for(i=0;i
2020-10-09 21:47:09
#include <stdio.h> int main(){ int i,j; int a[4][2]; for(i=0;i<4;i++){ for(j=0;j<2;j++){ printf("a[%d][%d]=",i,j); scanf("%d",&a[i][j]); } } printf("输出的二维数组是:\n"); for(i=0;i<4;i++){ for(j=0
2020-10-08 15:33:36
#include <stdio.h>void main(){ int grade[10]={1,2,3,4,5,6,7,8,9,10}; int total=0; int i; float avg; for(i=0;i<10;i++){ total+=grade[i]; } avg=((float)total/10); printf("the student's average
2020-10-04 18:11:56
#include <stdio.h>int main(){ int iArray[3],index; printf("请输入语文,数学和英语的成绩:\n"); for(index=0;index<3;index++){ scanf("%d",&iArray[index]); } printf("语文,数学和英语的成绩是:\n"); for(index=0;index<3;index++){ print
2020-10-03 13:03:46
#include <stdio.h>int main(){int i,j,k,n; printf("please enter a number\n"); scanf("%d",&n); for(i=1;i<=n;i++) { for(j=1;j<=n-i;j++)
2020-10-03 10:41:35
#include <stdio.h>int main(){ int iNumber; int iSum=0; for(iNumber=1;iNumber<=100;iNumber++){ iSum=iNumber+iSum; } printf("the result is %d\n",iSum); iSum=0; iNumber=1; while(iN
2020-09-21 23:12:57
#include <stdio.h>int main(){ int num=0; scanf("%d",&num); do { num++; printf("还能承载%d个人,\n",26-num); }while(num<=25); printf("座位已满,还能承载0人.\n"); return 0;}
2020-09-16 23:57:53
在C语言里使用while猜一个数字直到猜对为止,程序如下:#include <stdio.h>int main(){ int num; printf("请输入一个数字,如果提示你猜大了,你换一个小数字,如果提示你猜小了,你换一个大数字,知道猜对为止\n"); while(num!=147){ scanf("%d",&num); if(num<147){ printf("你猜小了\n&q
2020-09-13 22:17:16
#include <stdio.h>int main(){ int iMonth=0,iDay=0; printf("enter the month you want to know the days\n"); scanf("%d",&iMonth); switch(iMonth){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: iDay=31; break; c
2020-09-13 22:07:22
#include <stdio.h>int main(){ int month; printf("please enter a month:\n"); scanf("%d",&month); switch(month){ case 3: case 4: case 5: printf("%d is spring\n",month); break; case 6: case 7: case 8: pri