416-20 guruh talabasi Kaljanov Shuxrat
Kun.oy.yil 13.09.2002
3-labarotoriya ishi
1. if, if else operatorlariga doir topshiriqlar
#include
#include
using namespace std ;
int main ( )
{
double a,b,c,d,x,Y ;
cout<<"b=";cin>>b;
cout<<"c=";cin>>c;
cout<<"d=";cin>>d;
cout<<"x=";cin>>x;
a=d*d+(c*d)/(c*c-d*d) ;
if(a<5) {
Y=1/pow((1+x*x),1./2) ;
} else
if(a>=5) {
Y=b*sin(a) ;
} else
cout.precision( ) ;
cout<<"Y="<return 0 ;
}
2.
3. Switch casetanlash operatoridan foydalanib , o’zgaruvchilarning barcha qiymatlari uchun funkstiyani hisoblash dasturini tuzing
#include
using namespace std ;
int main ( )
{
int k ;
cout<<" k ni kiriting=" ;
cin>>k;
if(k==1) cout<<"yomon";
if(k==2) cout<<"qoniqarsiz";
if(k==3) cout<<"qoniqarli";
if(k==4) cout<<"yaqshi";
if(k==5) cout<<"alo";
else cout<<"xato";
}
Do'stlaringiz bilan baham: |