if(min1>a)min1=a;
}
cout<<"max*min:"<
return 0;
}
135. Teng yonli uchburchakning elementlari quyidagi tartibda nomerlangan. 1-katet a, 2-gipotenuza , 3-gipotenuzaga tushirilgan balandlik h=c/2, 4-yuzasi S= . Shu elementlardan bittasi berilganda qolganlarini topuvchi programma tuzilsin.
#include
//135-masala @TBCLbot
using namespace std;
int main()
{
int n;
cin>>n;
float a,c,h,s;
switch(n)
{
case 1:{cout<<"a=";cin>>a;c=a*sqrt(2);h=(c/2);s=c*h*1./2;cout<<"c="<
case 2:{cout<<"c=";cin>>c;a=c*1./sqrt(2);h=c/2;s=c*h*1./2;cout<<"a="<
case 3:{cout<<"h=";cin>>h;a=sqrt(2)*h;c=2*h;s=c*h*1./2;cout<<"a="<
case 4:{cout<<"s=";cin>>s;a=sqrt(2*s);c=2*sqrt(s);h=sqrt(h);cout<<"c="<
default :cout<<"1-4 oralig'idagi son kiriting!";
}
return 0;
}
136. Og'irlik birliklari quyidagi tartibda berilgan. 1-kilogramm, 2-milligramm, 3-gramm, 4-tonna, 5-sentner. Og'irlik birligini bildiruvchi soni berilgan va shu birlikdagi og'irlik qiymati berilgan. Og'irlikni kilogramda ifodalovchi programma tuzilsin.
#include
//136-masala @TBCLbot
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
switch(n)
{
case 1:{cout<<"m="<
case 2:{cout<<"m="<
case 3:{cout<<"m="<
case 4:{cout<<"m="<
case 5:{cout<<"m="<
default :cout<<"1-5 oralig'idagi son kiriting!";
}
return 0;
}
137. 1-7 gacha bo’lgan butun sonlar berilgan. Kiritilgan songa mos ravishda hafta kunlarini so’zda ifodalovchi programma tuzilsin. (1-Dushanba,2-Chorshanba,...h.k).
#include
//137-masala @TBCLbot
using namespace std;
int main()
{
int n;
cin>>n;
switch(n)
{
case 1:cout<<"Dushanba";break;
case 2:cout<<"Seshanba";break;
case 3:cout<<"Chorshanba";break;
case 4:cout<<"Payshanba";break;
case 5:cout<<"Juma";break;
case 6:cout<<"Shanba";break;
case 7:cout<<"Yakshanba";break;
default :cout<<"Bunaqqa hafta kuni yo'q!";
}
return 0;
}
138. a, b, c butun sonlar berilgan. Jumlani rostlikka tekshiring: „a, b, c tomonli uchburchak teng tomonli bo’ladi”.
#include
//138-masala @TBCLbot
using namespace std;
int main()
{
float a,b,c;
cin>>a>>b>>c;
if(a==b&&b!=c&&a!=c)
cout<<"Rost";
else if(b==c&&b!=a&&c!=a)
cout<<"Rost";
else if(c==a&&a!=b&&c!=b)
cout<<"Rost";
else cout<<"Yolg'on";
return 0;
}
139. a, b, c butun sonlar berilgan. Jumlani rostlikka tekshiring: „a, b, c tomonli uchburchak teng yonli bo’ladi”.
#include
//139-masala @TBCLbot
using namespace std;
int main()
{
float a,b,c;
cin>>a>>b>>c;
if(a==b&&b!=c&&a!=c)
cout<<"Rost";
else if(b==c&&b!=a&&c!=a)
cout<<"Rost";
else if(c==a&&a!=b&&c!=b)
cout<<"Rost";
else cout<<"Yolg'on";
return 0;
}
140. a, b, c butun sonlar berilgan. Jumlani rostlikka tekshiring: „a, b, c tomonli uchburchak to’g’ri burchali bo’ladi”.
#include
//140-masala @TBCLbot
using namespace std;
int main()
{
float a,b,c;
cin>>a>>b>>c;
if(a*a+b*b==c*c)
cout<<"Rost";
else if(a*a+c*c==b*b)
cout<<"Rost";
else if(c*c+b*b==a*a)
cout<<"Rost";
else cout<<"Yolg'on";
return 0;
}
141. a, b, c butun sonlar berilgan. Jumlani rostlikka tekshiring: „a, b, c tomonli uchburchak yasash mumkin”.
#include
//141-masala @TBCLbot
using namespace std;
int main()
{
float a,b,c;
cin>>a>>b>>c;
if(a+b>c&&a+c>b&&b+c>a)
cout<<"rost";
else cout<<"Yolg'on";
return 0;
}
142. Ixtiyoriy a, b lar uchun ax3+bx=0 tenglamani yechadigan dasturni yozing. Barcha haqiqiy yechimlar topilsin.
#include
//142-masala @TBCLbot
using namespace std;
int main()
{
float a,b,x1,x2;
cin>>a>>b;
x1=0;
x2=sqrt(b*1./a);
cout<<"x1="<
return 0;
}
143. Berilgan uchta son asosida, ulardan ixtiyoriy ikkitasining yig’indisi musbat ekanligini aniqlovchi dastur tuzing.
#include
//143-masala @TBCLbot
using namespace std;
int main()
{
float a,b,c;
cin>>a>>b>>c;
if(a+b>0||a+c>b||b+c>a)
cout<<"rost";
else cout<<"Yolg'on";
return 0;
}
144. To’rtta a1, a2, a3 va a4 sondan bittasi, o’zaro teng bo’lgan boshqa uchtasidan farqli ekanligi ma’lum, shu songa n o’zgaruvchi raqamini bering.
#include
//144-masala @TBCLbot
using namespace std;
int main()
{
int a,b,c,d,n;
cin>>a>>b>>c>>d;
cout<<"n=";cin>>n;
if(a==b && b==c)d=n;
else
if(a==b && b==d)c=n;
else
if(a==c && c==d)b=n;
cout<<"a1:"<
cout<<"a2:"<
cout<<"a3:"<
cout<<"a4:"<
return 0;
}
145. Markazi (x1,y1) nuqtada bo’lgan R radiusli aylana bilan (x0,y0) koordinatali nuqtaning o’zaro joylashish holatini aniqlovchi dastur tuzing.
#include
//145-masala @TBCLbot
using namespace std;
int main()
{
float x,y,x1,y1,r,n;
cout<<"Aylana koordinatalari:";cin>>x>>y;
cout<<"Nuqta (x1,y1):";cin>>x1>>y1;
cout<<”Aylana radiusi:”;cin>>r;
n=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1);
if(r>n)cout<<"nuqta aylana ichida joylashgan";
else if(n
else cout<<"Nuqta aylana markazida joylashgan";
return 0;
}
146. Manfiy bo’lmagan a butun sonni b musbat songa bo’lgandan hosil bo’lgan qoldig’i, berilgan c yoki d sonlarning birortasiga tengligini aniqlang.
#include
//146-masala @TBCLbot
using namespace std;
int main()
{
int a,b,c,d;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
if(a%b==c||a%b==d)
{
if(a%b==c)
cout<<"a ni b ga bo'lgandagi qoldiq c";
else
cout<<"a ni b ga bo'lgandagi qoldiq d";
}
else
cout<<"a ni b ga bo'lgandagi qoldiq c ga ham d ga ham teng emas";
return 0;
}
147. a, b, c uchta haqiqiy sonlar berilgan. Hech bo’lmaganda bitta juftlikning o’zaro teng sonlar ekanligini aniqlash dasturini tuzing.
#include
//147-masala @TBCLbot
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<"n=";cin>>n;
if(a==b || b==c || c==a)
{
if(a==b);
cout<<"a son b ga teng";
else if(b==c)
cout<<"b son c ga teng";
else
cout<<"c son a ga teng";
}
else cout<<"a,b,c sonlardan birortasi bir-biriga teng emas!";
return 0;
}
148. a, b, c tomonli uchburchakning teng yonli ekanligini aniqlang.
#include
//148-masala @TBCLbot
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<"n=";cin>>n;
if(a==b || b==c || c==a)
{
if(a==b&&a!=c);
cout<<"bu uchburchak teng yonli";
else if(b==c&&b!=a)
cout<<"bu uchburchak teng yonli";
else if(c==a&&b!=c)
cout<<"bu uchburchak teng yonli";
}
else cout<<"bu uchburchak teng yonli uchburchak teng emas";
return 0;
}
149. a1, a2, …, an haqiqiy sonlar ketma-ketligi berilgan. Uning [c;d] kesmada yotgan elementlarini ko’rsating.
#include
//149-masala @TBCLbot
using namespace std;
int main()
{
int n,c,d;
cout<<"n=";cin>>n;
int a[n];
for(int i=1;i<=n;i++)
cin>>a[i];
cout<<"c=";cin>>c;
cout<<"d=";cin>>d;
for(int i=c;i<=d;i++)
cout<
return 0;
}
150. Butun sonli massivning 9 ga karrali elementlari ko’paytmasini toping.
#include
//150-masala @TBCLbot
using namespace std;
int main()
{
int n;
cout<<"n=";cin>>n;
int a[n];
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=n;i++)
if(a[i]%9==0)
cout<
return 0;
}
151. Berilgan N ta natural sonlardan faqat juftlarini yig’indisini topish dasturing tuzing.
#include
//151masala @TBCLbot
using namespace std;
int main()
{
int n,s=0;
cout<<"n=";cin>>n;
int a[n];
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]%2==0)s+=a[i];
}
cout<<"s="<
return 0;
}
152. Berilgan N ta natural sonlardan faqat toqlarini yig’indisini topish dasturing tuzing.
#include
//152-masala @TBCLbot
using namespace std;
int main()
{
int n,s=0;
cout<<"n=";cin>>n;
int a[n];
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]%2!=0)s+=a[i];
}
cout<<"s="<
return 0;
}
153. Ikkita sonning yig’indisini topish funksiyasini yozing va unga murojaat qiling.
#include
//153-masala @TBCLbot
using namespace std;
int SUMMA(int a,int b)
{
return a+b;
}
int main()
{
int a,b;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"a+b="<
return 0;
}
154. Ikkita sonning ko’paytmasini topish funksiyasini yozing va unga murojaat qiling.
#include
//154-masala @TBCLbot
using namespace std;
int SUMMA(int a,int b)
{
return a*b;
}
int main()
{
int a,b;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"a*b="<
return 0;
}
155. Ikkita sonning ayirmasini topish funksiyasini yozing va unga murojaat qiling.
#include
//155-masala @TBCLbot
using namespace std;
int SUMMA(int a,int b)
{
return a-b;
}
int main()
{
int a,b;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"a-b="<
return 0;
}
156. Ikkita sonning bo’linmasini topish funksiyasini yozing va unga murojaat qiling.
#include
//154-masala @TBCLbot
using namespace std;
int SUMMA(int a,int b)
{
return a/b;
}
int main()
{
int a,b;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"a/b="<
return 0;
}
157. To’g’ri to’rtburchakning tomonlari a va b berilgan. Uning yuzasini aniqlash funksiyasini yozing va unga murojaat qiling.
#include
//157-masala @TBCLbot
using namespace std;
int YUZA(int a,int b)
{
return a*b;
}
int main()
{
int a,b;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"S="<
return 0;
}
158. Doiraning radiusi berilgan. Uning yuzasini aniqlash funksiyasini yozing va unga murojaat qiling.
#include
//158-masala @TBCLbot
using namespace std;
float YUZA(float r)
{
return r*r*M_PI;
}
int main()
{
float r;
cout<<"r=";cin>>r;
cout<<"S="<
return 0;
}
159. Teng yonli trapetsiyaning a va b asoslari, balandligi berilgan. Uning yuzasini topish funksiyani yozing va unga murojaat qiling.
#include
//159-masala @TBCLbot
using namespace std;
int YUZA(int a,int b,float h)
{
return (a+b)*h*1./2;
}
int main()
{
int a,b;
float h;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"h=";cin>>h;
cout<<"S="<
return 0;
}
160. Kvadratning tomoni a berilgan. Berilgan kvadratning diametrini topish funksiyasini yozing va unga murojaat qiling.
#include
//160-masala @TBCLbot
using namespace std;
int Radius(int a)
{
return a/2;
}
int main()
{
int a;
cout<<"a=";cin>>a;
cout<<"R="<
return 0;
}
161. Berilgan satrda nechta kichik a harfi qatnashganini aniqlash dasturini tuzing.
#include
//161-masala @TBCLbot
using namespace std;
int main()
{
string a;
int k=0;
cout<<"Satr kiriting:";getline(cin,a);
for(int i=0;i
{
if(a[i]=='a')
k++;
}
cout<<"satrdagi a harflar soni: "<
return 0;
}
162. Berilgan satrda nechta kichik b harfi qatnashganini aniqlash dasturini tuzing.
#include
//162-masala @TBCLbot
using namespace std;
int main()
{
string a;
int k=0;
cout<<"Satr kiriting:";getline(cin,a);
for(int i=0;i
{
if(a[i]=='b')
k++;
}
cout<<"satrdagi b harflar soni: "<
return 0;
}
163. Berilgan satrda nechta vergul, nuqta, so’roq belgisi qatnashganini aniqlash dasturini tuzing.
#include
//163-masala @TBCLbot
using namespace std;
int main()
{
string a;
int k=0,k1=0,k2=0;
cout<<"Satr kiriting:";getline(cin,a);
for(int i=0;i
{
if(a[i]==','||a[i]==’.’||a[i]==’?’)
k++;
}
cout<<"satrdagi vergul,nuqta,so’roqlar soni: "<
return 0;
}
164. Berilgan satrda nechta raqam qatnashganini aniqlash dasturini aniqlang.
#include
//164-masala @TBCLbot
using namespace std;
int main()
{
string a;
int k=0;
cout<<"Satr kiriting:";getline(cin,a);
for(int i=0;i
{
if(48<=a[i]&&a[i]<=57)
k++;
}
cout<<"satrdagi raqamlar soni: "<
return 0;
}
165. Uchta satr berilgan. Bu satrlarni birlashtirish dasturini tuzing.
#include
//165-masala @TBCLbot
using namespace std;
int main()
{
string s,s1,s2,s3;
cout<<"Satr kiriting:s1=";getline(cin,s1);
cout<<"Satr kiriting:s2=";getline(cin,s2);
cout<<"Satr kiriting:s3=";getline(cin,s3);
s=s1+s2+s3;
cout<<"s1,s2,s3 satrlar birlashmasi: "<
return 0;
}
166. Matn berilgan. Bu matnda “lar” qismiy satri necha marta uchrashini aniqlash dasturini tuzing.
#include
//166-masala @TBCLbot
using namespace std;
int main()
{
string s,s1="lar";
int k=0,m=0,n=0;
cout<<"Satr kiriting: ";getline(cin,s);
for(int i=0;i
{
k=s.find(s1,i);
// cout<<"k="<
if(k!=m&&k!=-1)
n++;
m=k;
}
cout<<"\nn="<
return 0;
}
167. „Talaba“ strukturasini yozing va unga boshlang’ich qiymat bering. Uning 4 ta maydoni bo’lsin.
#include
//167-misol
using namespace std;
struct Talaba
{
string ism;
string familiya;
int kurs;
int ball;
};
int main()
{
Talaba a ={"Lazizbek","Karimov",1,5};
return 0;
}
168. „Guruh“ strukturasini yozing va unga boshlang’ich qiymat bering. Uning 4 ta maydoni bo’lsin.
#include
//168-masala @TBCLbot