Advertisement
Guest User

P7A2

a guest
Nov 20th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <stdio.h>
  4. #include <math.h>
  5. #include <ctype.h>
  6.  
  7. int main(void)
  8. {
  9.     char restart[2];
  10.  
  11.     do
  12.     {
  13.         int ab = 0, cd = 0, index = 0, abcd1 = 0, abcd2 = 0;
  14.         for  (index = 1000; index < 10000; index++)
  15.         {
  16.             ab = index / 100;
  17.             cd = index % 100;
  18.  
  19.             abcd1 = pow(ab, 2) + pow(cd, 2);
  20.             abcd2 = pow((ab + cd), 2);
  21.             if (index == abcd1 || index == abcd2)
  22.                 printf("\n\t%i", index);
  23.         }
  24.         printf("\n\nFertig. Moechten Sie das Programm neu starten? J/N\n");
  25.         scanf("%c", restart);
  26.         getchar();
  27.  
  28.         restart[0] = toupper(restart[0]);
  29.  
  30.     } while (restart[0] == 'J');
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement