Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ODEJMOWANIE DUZYCH LICZB
- // ALEKSANDER SZEWCZAK
- #include <stdio.h>
- int main(void)
- {
- unsigned int ile;
- int i;
- printf("Ile liczb maja miec cyfry? ");
- scanf("%d", &ile);
- int tab[ile], tab2[ile], w[ile];
- printf("Wypisz liczbe nr 1: ");
- for(i = 0; i < ile; i++) scanf("%1d", &tab[i]);
- printf("Wypisz liczbe nr 2: ");
- for(i = 0; i < ile; i++) scanf("%1d", &tab2[i]);
- for(i = 0; i < ile; i++) printf("%1d", tab[i]);
- printf(" - ");
- for(i = 0; i < ile; i++) printf("%1d", tab2[i]);
- printf(" = ");
- for(i = 0; i < ile; i++)
- {
- w[i] = 0;
- }
- for(i = 0; i < ile; i++)
- {
- w[i] += tab[i];
- w[i] -= tab2[i];
- if(w[i] < 0)
- {
- w[i-1] -= 1;
- w[i] +=10;
- }
- }
- for(i = 0; i < ile; i++) printf("%d", w[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement