Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void main()
- {
- int n,s=0,p=1;
- printf ("Introdu un numar intreg: \n ");
- scanf ("%d",&n);
- if (n%2==0)
- {
- while (n!=0)
- {
- s=s+n%10;
- n=n/10;
- }
- printf ("Suma cifrelor este %d \n ", s);
- }
- else
- {
- while (n!=0)
- {
- p=p*n%10;
- n=n/10;
- }
- printf ("Produsul cifrelor este %d \n ", p);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement