Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n;
- int i;
- int ZbircifriNeparni;
- int maxNeparni=0;
- int minParni=0;
- int ZbircifriParni=0;
- int temnp;
- int temp;
- int first=1;
- int maxNeparnibroj;
- int minParniBroj;
- while(scanf("%d", &n))
- {
- temnp=n;
- temp=n;
- ZbircifriNeparni=0;
- ZbircifriParni=0;
- while(temnp)
- {
- temnp/=10;
- ZbircifriNeparni=ZbircifriNeparni+temnp%10;
- temnp/=10;
- }
- while(temp)
- {
- ZbircifriParni=ZbircifriParni+temp%10;
- temp/=100;
- }
- if(ZbircifriNeparni>maxNeparni){
- maxNeparni=ZbircifriNeparni;
- maxNeparnibroj=n;
- }
- if(first)
- {
- minParni=ZbircifriParni;
- first=0;
- }
- else if(ZbircifriParni<minParni)
- {
- ZbircifriParni=minParni;
- minParniBroj=n;
- }
- }
- printf("Parni: %d, NeParni: %d\n", minParniBroj, maxNeparnibroj);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement