Advertisement
Natirium

uneven addition

Feb 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     long long unsigned int zahl,zielzahl,zahlmenge,pruefzahl=0;
  7.     long long int binaervergleich=1;
  8.     long long unsigned int summe =0;
  9.     long long unsigned int *sp;
  10.  
  11.     printf("Enter a number: ");
  12.     scanf("%lld",&zahl);
  13.  
  14.     printf("\nEnter the number to count to: ");
  15.     scanf("%lld",&zielzahl);
  16.  
  17.     zahlmenge = zielzahl-zahl;
  18.  
  19.     printf("\n%lld Numbers to test\n\n",zahlmenge-1);
  20.     pruefzahl = pruefzahl + zahl;
  21.     summe = zahl;
  22.  
  23.         for (pruefzahl = pruefzahl+1;pruefzahl <= zahlmenge;pruefzahl++){
  24.  
  25.  
  26.             if ((pruefzahl&binaervergleich) == 1 ){
  27.                 sp = &summe;
  28.                 printf("%lld is uneven\nwill add to number:%lld the value:%lld ",pruefzahl,*sp,pruefzahl);
  29.                 *sp = *sp + pruefzahl;
  30.                 printf("result=%lld\n",summe);
  31.             }
  32.             else{
  33.                 printf("%lld is even\n",pruefzahl);
  34.             }
  35.  
  36.         }
  37.         printf("\nSum of all additions:%lld",summe);
  38.  
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement