Nazariy qism. If va if else


Download 157.21 Kb.
bet3/3
Sana21.11.2020
Hajmi157.21 Kb.
#149706
1   2   3
Bog'liq
3- labaratoriya


3-Masalaning qo’yilishi:
Case17. O’quv masalalarini raqamini aniqlovchi 10-50 gacha butun son berilgan. Son kirirtilganda masala raqamini unga mos so’zlarda ifodalovchi dastur tuzilsin. (“yigirmanchi masala”, “o’ttiz beshinchi masala” va hk)

#include

using namespace std;

int main()

{

int n;


cout<<"n="; cin>>n;

switch(n/10){

case 1:cout<<"o'n"; break;

case 2:cout<<"yigizma"; break;

case 3:cout<<"o'ttiz"; break;

case 4:cout<<"qirq"; break;

case 5:cout<<"ellik"; break;

default:cout<<"xato kiritildi";

}

switch(n%10){



case 1:cout<<" birinchi masala"; break;

case 2:cout<<" ikkinchi masala"; break;

case 3:cout<<" uchinchi masala"; break;

case 4:cout<<" to'rtinchi masala"; break;

case 5:cout<<" bechinchi masala"; break;

case 6:cout<<" oltiinchi masala"; break;

case 7:cout<<" yettinchi masala"; break;

case 8:cout<<" sakkizinchi masala"; break;

case 9:cout<<" to'qqizinchi masala"; break;

case 0:cout<<"inchi masala"; break;



}

return 0;



}



211_20. Shohruh Berdikulov.
Download 157.21 Kb.

Do'stlaringiz bilan baham:
1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling