Telekomunikatsion texnologiyalar


Download 349.75 Kb.
Sana28.07.2023
Hajmi349.75 Kb.
#1663392
Bog'liq
deadline








MUHAMMAD AL-XORAZMIY NOMIDAGI


TOSHKEMT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
“TELEKOMUNIKATSION TEXNOLOGIYALAR” yo’nalishi
talabasi
Uzakov A’zam
“ DASTURLASH I” fanidan tayyorlagan
AMALIY ishi

35-VARIANT
1-Topshiriq:


  1. Berilgan sanadan boshlab yangi yilga qadar qancha muddat qolganini topuvchi funksiya hosil qiling. Ushbu funksiya yordamida day1,day2 kundan yangi yilgacha qancha muddat qolganini hisoblang.

  2. Berilgan kundan keyingi kunni chiqaruvchi funksiya hosil qiling. Ushbu funksiya yordamida day1, day2,day3 larni hisoblang.

a)Kod:
#include

int daysUntilNewYear(int day, int month, int year) {


int newYearDay = 1;
int newYearMonth = 1;
if (month < newYearMonth || (month == newYearMonth && day < newYearDay)) {
return (newYearMonth - month - 1) * 30 + (30 - day) + newYearDay;
}
else {
return (12 - month) * 30 + (newYearMonth - month - 1) * 30 + (30 - day) + newYearDay;
}
}

int main() {


int day, month, year;
std::cout << "Sanani kiriting (kun/oy/yil): ";
std::cin >> day >> month >> year;
int remainingDays = daysUntilNewYear(day, month, year);
std::cout << "Yangi yilgacha qolgan kun: " << remainingDays << std::endl;
return 0;
}
Natija:

b) Kod:
#include
using namespace std;
int main(){
int a,b,c;
cin >>a>>b>>c;
cout <return 0;


}
Natija:







Download 349.75 Kb.

Do'stlaringiz bilan baham:




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