Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- long num;
- long suma = 0L; //przypisanie zmiennej suma warosci poczatkowej zero
- int stan;
- printf("Podaj liczbe calkowita do zsumowania. ");
- printf("wpisz q, aby zakonczyc program.\n");
- stan = scanf("%1d", &num);
- while (stan == 1)
- {
- suma = suma + num;
- printf("Podaj nastepna liczbe calkowita do zumowania.");
- printf("wpisz q any zakonczyc program.\n");
- stan = scanf("%1d", &num);
- }
- printf("Suma podanych liczb wynosi %1d.\n", suma);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement