MAVZU: TARMOQLANISH VA UZILISHLARNI TASHKIL ETISH OPERATORLARI.
14
;
Dastur kodi:
#include #include using namespace std ;
int main() {
double a ; cout << "A: " ; cin >> a ;
double y ;
double x = 23.4 ;
if (a > 5){
y = a / (pow(a , 2) + x);
} else {
y = 1 / (2 * pow(a , 2) + sin(a)) ;
}
cout << "\n\n" << y << endl ;
return EXIT_SUCCESS ;
}
Dastur natijasi:
Case14. Oy raqami berilgan. Shu oyda nechta kun borligini aniqlovchi dastur tuzilsin..
Dastur kodi:
#include #include using namespace std ;
int main() {
int oy ;
cout << "oy: " ; cin >> oy ;
switch(oy) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
cout << "bu oyda 31 kun bor" << endl ;
break ;
case 2 :
cout << "bu oyda 28 kun bor " << endl ;
break ;
case 4 : case 6: case 9 : case 11: cout << "bu oyda 30 kun bor" << endl;
default :
cout << "noto'g'ri son kirildi" ;
}
return 0 ;
}
Dastur natijasi: