Advertisement
Dani_info

pb 14/59

Nov 26th, 2017
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. { //pb.14/59
  7.     int n, k, sumanr=0, sumacifre=0, cat, rest, uc, p;
  8.     cout<<"Pana la ce numar doriti sa cititi??"<<endl;
  9.     cin>>k;
  10.     while(n!=k)
  11.         {cout<<"Introduceti numarul:"; cin>>n;
  12.          sumanr=sumanr+n;
  13.          p=sumanr;
  14.         }
  15.         while(sumanr!=0)
  16.         {
  17.             uc=sumanr%10;
  18.             sumacifre=sumacifre+uc;
  19.             sumanr=sumanr/10;
  20.         }
  21.     cat=p/sumacifre;
  22.     rest=p%sumacifre;
  23.     cout<<"catul dintre suma nr si suma cifrelor sumei nr este:"<<cat<<endl;
  24.     cout<<"Restul dintre suma nr si suma cifrelor sumei nr este:"<<rest;
  25.  
  26.  
  27.     return 0;
  28. }
Advertisement
RAW Paste Data Copied
Advertisement