DEV Community

etibor2006
etibor2006

Posted on

+ - / * % HAQIDA MA'LUMOT,

  • - / * shulani hammasi matematikada qanaqa qanaqa vazifani bajarsa masala ishlashda ham huddi shunaqa.Faqatgina % boshqa funksiyani bildiradi.
 cout<< 3 / 10 << endl;
 cout << 3 % 10 ;
Enter fullscreen mode Exit fullscreen mode

% misolni suratini chiqazadi.

int a = 123;
   cout << a / 100 % 10 << endl;
   cout << a / 10 % 10 << endl;
  cout << a % 10;

  return 0;
}
Enter fullscreen mode Exit fullscreen mode

Sonlarni oldidan undov chiqarib ishlashimiz ham mumkin.

int son;
  cin >> son;
 cout << son / 10000 << '!';
 cout << son / 1000 % 10 << '!';
  cout << son / 100 % 10 << '!';
 cout << son / 10 % 10 << '!';
 cout << son % 10 ;
  return 0;
}
Enter fullscreen mode Exit fullscreen mode

5 honali soni o'rtasidan 3 honadagi soni oshimiz ham mumkin.

int son;
  cin>>son; 

 cout << son / 100 % 10;

  return 0;
}
Enter fullscreen mode Exit fullscreen mode

@dawroun

Top comments (0)