Using namespace std; int main int



Download 292,29 Kb.
Sana03.04.2022
Hajmi292,29 Kb.
#525878
Bog'liq
13-var


1-laboratoriya


Case13. 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
#include
using namespace std;


int main(int argc, const char * argv[]) {
int n,a,b;
cout<<" n= "; cin>>n;
a = n/10;
b = n%10;
switch (a) {
case 1:cout<<"o`n";{
switch (b) {
case 0: cout<<"inchi masala\n"; break;
case 1: cout<<" birinchi masala\n"; break;
case 2: cout<<" ikkinchi masala\n"; break;
case 3: cout<<" uchinchi masala\n"; break;
case 4: cout<<" to`rtinchi masala\n"; break;
case 5: cout<<" beshinchi masala\n"; break;
case 6: cout<<" oltinchi masala\n"; break;
case 7: cout<<" yettinchi masala\n"; break;
case 8: cout<<" sakkizinchi masala\n"; break;
case 9: cout<<" to`qqizinchi masala\n"; break;
}
} break;
case 2:cout<<"yigirma";{
switch (b) {
case 0: cout<<"inchi masala\n"; break;
case 1: cout<<" birinchi masala\n"; break;
case 2: cout<<" ikkinchi masala\n"; break;
case 3: cout<<" uchinchi masala\n"; break;
case 4: cout<<" to`rtinchi masala\n"; break;
case 5: cout<<" beshinchi masala\n"; break;
case 6: cout<<" oltinchi masala\n"; break;
case 7: cout<<" yettinchi masala\n"; break;
case 8: cout<<" sakkizinchi masala\n"; break;
case 9: cout<<" to`qqizinchi masala\n"; break;
}
} break;
case 3:cout<<"o`ttiz";{
switch (b) {
case 0: cout<<"inchi masala\n"; break;
case 1: cout<<" birinchi masala\n"; break;
case 2: cout<<" ikkinchi masala\n"; break;
case 3: cout<<" uchinchi masala\n"; break;
case 4: cout<<" to`rtinchi masala\n"; break;
case 5: cout<<" beshinchi masala\n"; break;
case 6: cout<<" oltinchi masala\n"; break;
case 7: cout<<" yettinchi masala\n"; break;
case 8: cout<<" sakkizinchi masala\n"; break;
case 9: cout<<" to`qqizinchi masala\n"; break;
}
} break;
case 4:cout<<"qirq";{
switch (b) {
case 0: cout<<"inchi masala\n"; break;
case 1: cout<<" birinchi masala\n"; break;
case 2: cout<<" ikkinchi masala\n"; break;
case 3: cout<<" uchinchi masala\n"; break;
case 4: cout<<" to`rtinchi masala\n"; break;
case 5: cout<<" beshinchi masala\n"; break;
case 6: cout<<" oltinchi masala\n"; break;
case 7: cout<<" yettinchi masala\n"; break;
case 8: cout<<" sakkizinchi masala\n"; break;
case 9: cout<<" to`qqizinchi masala\n"; break;
}
} break;
case 5:cout<<"ellik";{
switch (b) {
case 0: cout<<"inchi masala\n"; break;
case 1: cout<<" birinchi masala\n"; break;
case 2: cout<<" ikkinchi masala\n"; break;
case 3: cout<<" uchinchi masala\n"; break;
case 4: cout<<" to`rtinchi masala\n"; break;
case 5: cout<<" beshinchi masala\n"; break;
case 6: cout<<" oltinchi masala\n"; break;
case 7: cout<<" yettinchi masala\n"; break;
case 8: cout<<" sakkizinchi masala\n"; break;
case 9: cout<<" to`qqizinchi masala\n"; break;
}
} break;
}
return 0;



2-laboratoriya


13. 1 dan N gacha bo'lgan ketma-ketlikda to'rtga karra bo’lgan sonlaring oxirgi uchtasining yig’indisini toping.

#include


#include
using namespace std;


int main(int argc, const char * argv[]) {
int n,sum=0,a[100],l=0,t=0;
cout<<" n= ";
cin>>n;
for (int i=0; iif (i%4==0) {
a[l++] = i;
cout<<"\t"<}
}
cout<for (int i=l-1; i>=0; i--) {
if (t==3) break;
sum+=a[i];
t++;
}
cout<<"sum = "<return 0;
}



3-laboratoriya



  1. Berilgan radiusdan foydalanib aylananing uzunligini va doiraning yuzasini hisoblovchi funksiya yarating.Ushbu funksiya asosida r,r1,r2 radiuslar asosida hisoblang.

  2. Berilgan sonning raqamlar yig’indisini hisoblovchi funksiya hosil qiling. Bu funksiya yordamida a,b,c sonlarini raqamlar yig’indisini hisoblang.

a)

#include


#include
using namespace std;


void yuza(int r){
float l=0,s=0;
l = 2*M_PI*r;
s = M_PI*r*r;
cout<<"\n\naylana uzunligi : "<cout<<"doira yuzi: "<}


int main(int argc, const char * argv[]) {


int r,r1,r2;
cout<<" r = "; cin>>r;
cout<<" r1 = "; cin>>r1;
cout<<" r2 = "; cin>>r2;
yuza(r);
yuza(r1);
yuza(r2);
return 0;
}



b)

#include


#include
using namespace std;


int sum_num(int n){
int sum=0,i=0;
while (n>0) {
sum +=n%10;
n/=10;
}
return sum;
}


int main(int argc, const char * argv[]) {


int a,a1,a2;
cout<<" a = "; cin>>a;
cout<<" a1 = "; cin>>a1;
cout<<" a2 = "; cin>>a2;
cout <cout <cout <return 0;
}

Download 292,29 Kb.

Do'stlaringiz bilan baham:




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish