Advertisement
edutedu

Sa se genereze nr obtinut prin introducerea pe rand a cifrel

Sep 18th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. int n, nr=0,P=1,b=0;
  2. cin>>n;
  3. while(n<=9 && n>=0)
  4. {
  5. nr=nr*10+n;
  6. b=P*n+b;
  7. P=P*10;
  8. cin>>n;
  9. }
  10. cout<<nr<<endl;
  11. cout<<b<<endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement