- - / * shulani hammasi matematikada qanaqa qanaqa vazifani bajarsa masala ishlashda ham huddi shunaqa.Faqatgina % boshqa funksiyani bildiradi.
cout<< 3 / 10 << endl;
cout << 3 % 10 ;
% misolni suratini chiqazadi.
int a = 123;
cout << a / 100 % 10 << endl;
cout << a / 10 % 10 << endl;
cout << a % 10;
return 0;
}
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;
}
5 honali soni o'rtasidan 3 honadagi soni oshimiz ham mumkin.
int son;
cin>>son;
cout << son / 100 % 10;
return 0;
}
Top comments (0)