Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int x, a, b, c, suma;
- poczatek:
- printf("Podaj liczbe 3-cyfrowa: ");
- scanf("%d", &x);
- if (x<100 || x>999)
- {
- printf("Liczba musi byc trzycyfrowa!\n");
- goto poczatek;
- }
- a=x/100;
- b=x/10;
- b=b%10;
- c=x%10;
- suma=a+b+c;
- printf("%d\n%d\n%d\n", a, b, c);
- printf("Suma cyfr podanej liczby: %d + %d + %d = %d", a, b, c, suma);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement