Advertisement
Guest User

1.a)cifre>5

a guest
Nov 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n,c,x=0,i=1;
  6.     cin>>n;
  7.     do
  8.     {
  9.         c=n%10;
  10.         if(c>5)
  11.         {
  12.             i=i/10;
  13.         }
  14.         else
  15.         {
  16.             x=x+c*i;
  17.         }
  18.         i=i*10;
  19.         n=n/10;
  20.     }
  21.     while(n);
  22.         cout<<x;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement