151. 1 A 18 Sonlar o‟qida ikki nuqta berilgan. Bu nuqtalar orasidagi masofani toppish dasturini tuzing.
#include
#include
using namespace std;
int main(){
float a,b;
cout<<"a="; cin>>a;
cout<<"b=";cin>>b;
if(a>b) cout<if(aelse cout<<0;
return 0;
}
152. 1 A 7 Faylning hajmi baytlarda berilgan. Ushbu fayl necha Kb, Mb va Gb
ekanligini topish dasturini tuzing.
#include
#include
using namespace std;
int main(){
int a;
cout<<"a="; cin>>a;
cout<cout<cout<return 0;
}
153. Uch xonali natural son berilgan. Ushbu sonning oxirgi raqamini boshiga
o‟tkazish algoritmi va dasturini tuzing.
Misol: A=231. Almashtirishdan so’ng, A=123.
154. Uchta haqiqiy x,y,z sonlardan eng kattasini aniqlash dasturini tuzing.
155. ko‟rinishidagi kvadrat tenglamaning barcha
yechimlarini topish dasturini tuzing.
156. Uchta haqiqiy sonlar berilgan. Ulardan nechtasi (1,3) intervalga kirishini
aniqlovchi dastur tuzing. Agar bitta qiymat kirsa “BIR”, ikkita qiymat
kirsa “IKKI”, barchasi kirsa “UCH” yozuvlari, birorta ham kirmasi 0
qiymati chop etilsin
#include
using namespace std;
int main() {
float a,b,c,h=0;
cin>>a>>b>>c;
if(a>1 && a<3) h++;
if(b>1 && b<3) h++;
if(c>1 && c<3) h++;
if(h==0) cout<<0;
else if(h==1) cout<<"BIR";
else if(h==2) cout<<"IKKI";
else cout<<"UCH";
return 0;
}
157. A soni b sonining bo‟luvchisi ekanligini aniqlang. Agar bu shart bajarilsa, a ning qiymati ikki marta ortsin va ekranda “SHART BAJARILADI”, aks holda b ning qiymati ikki marta kamayib, “SHART bajarilmaydi” yozuvlari chop etilsin.
#include
using namespace std;
int main() {
int a,b;
cout<<"a="; cin>>a;
cout<<"b="; cin>>b;
if(b%a==0) cout< else cout< return 0;
}
Do'stlaringiz bilan baham: |