Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- unsigned obrni(unsigned x)
- {
- unsigned cifra, obrnut_broj=0;
- unsigned osnova=10000;
- while(x>0) {
- cifra=x%10;
- x/=10;
- obrnut_broj=obrnut_broj+cifra*osnova;
- osnova/=10;
- }
- return obrnut_broj;
- }
- int main()
- {
- unsigned x;
- scanf("%u/n", &x);
- if (x < 10000 || x > 99999) {
- fprintf(stderr, "Niste uneli petocifren broj!\n");
- exit(EXIT_FAILURE);
- }
- printf("%u\n", obrni(x));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement