fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int shincho[] = { 170, 165, 180, 195, 188, 0};
  6. int taiju[] = { 85, 65, 78, 80, 72, 0};
  7. int s, i, hit = 0;
  8.  
  9. printf("身長=\n");
  10. scanf("%d", &s);
  11. for( i=0 ; shincho[i] != 0 ; i++) {
  12. if (shincho[i] == s) {
  13. printf("体重=%d\n", taiju[i]);
  14. hit++;
  15. }
  16. }
  17. if (hit == 0) printf("みつかりません。\n");
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 1724KB
stdin
180
stdout
身長=
体重=78