计算三个数的和

匿名 (未验证) 提交于 2019-12-02 23:43:01

#include <time.h> #include <stdio.h> #include <stdlib.h>  int main(void) {     int stage;     int a, b, c;                 int x;                         int n;                         clock_t    start, end;          srand(time(NULL));          printf("input the result \n");     start = clock();                  for (stage = 0; stage < 10; stage++) {         a = 10 + rand() % 90;             b = 10 + rand() % 90;                 c = 10 + rand() % 90;             n = rand() % 17;                  printf("%d%*s+%*s%d%*s+%*s%d  =", a, n, "", n, "", b, n, "", n, "", c);          do {             scanf("%d", &x);             if (x == a + b + c)                 break;             printf("\awrong,input again!");         } while (1);     }      end = clock();                      printf("hello world\n", (double)(end - start) / CLOCKS_PER_SEC);      return 0; }

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!