Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Se citeste un nr pozitiv intreg. Determinati cate cifre pare si respectiv impare are numarul.
- int main()
- {
- int n,p=0,i=0,cif;
- cout<< "citi pe n";
- cin>>n;
- while (n!=0){
- cif=n%10;
- n=n/10;
- if(cif%2==0)
- p=p+1;
- if(cif%2!=0)
- i=i+1;
- cout<<"cifrele impare sunt in numar de"<<i;
- cout<<"cifrele pare sunt in numar de "<<p;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement