Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int nrcif(int n)
  5. {
  6. int c;
  7. while(n!=0)
  8. {
  9. c++;
  10. n/=10;
  11. }
  12. return c;
  13. }
  14. int nrreal(int x, int y)
  15. {
  16. int a,i,p=1;
  17. double c;
  18. a = nrcif(y);
  19. for(i = 1; i <= a; i++)
  20. p*=10;
  21. c = x + y/p;
  22. return c;
  23.  
  24. }
  25. int main()
  26. {
  27.  
  28. cout << nrreal(12,543);
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement