Shart operatorini ishlatmang


Download 51.15 Kb.
Sana15.06.2023
Hajmi51.15 Kb.
#1478817
Bog'liq
misol 5


Integer27. Hafta kunlari quyidagicha tartibda berilgan. 1-dushanba, 2-seshanba, 3-chorshanba, 4- payshanba, 5-juma, 6-shanba, 7-yakshanba. 1-365 oraliqda yotuvchi К soni berilgan. Agar 1-yanvar yakshanba bo’lsa, kiritilgan К - kun haftaning qaysi kuniga to'g'ri kelishini aniqlovchi programma tuzilsin. ( shart operatorini ishlatmang)

#include


#include
using namespace std;
int main()
{
int a,b,c;
cout<<"1-365 oraliqda yotuvchi sonni kiriting -> ";cin>>a;
b=a/7; c=a-b*7;
{
if (c==1)
cout<<" Yakshanba ";
}
{
if (c==2)
cout<<" Dushanba ";
}
{
if (c==3)
cout<<" Seshanba ";
}
{
if (c==4)
cout<<" Chorshanba ";
}
{
if (c==5)
cout<<" Payshanba ";
}
{
if (c==6)
cout<<" Juma ";
}
{
if (c==0)
cout<<" Shanba ";
}
system ("pause");
return 0;
}

NATIJA:

Download 51.15 Kb.

Do'stlaringiz bilan baham:




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