Geometrik shakllar :: Yechimlar
Masala A
Kiritilgan burchak qiymatini 2 xona aniqlikda radianga o‘tkazadigan dastur tuzing.
-1000 dan 1000 gacha bo’lgan son
Kiritilgan burchakning radiandagi qiymati
#include <stdio.h>
int main() {
int d;
scanf("%d", &d);
printf("%.2f", d * 3.14f / 180);
return 0;
}
def main():
d = int(input())
print(f"{d * 3.14 / 180:.2f}")
if __name__ == '__main__':
main()
Masala B
Kiritilgan doira radiusidan kelib chiqib uning aylanasi uzunligi va doirasi yuzini 3 xona aniqlikda hisoblab ekranga chiqaradigan dastur tuzing.
0.01 dan 1000 gacha bo’lgan haqiqiy son
Birinchi qatorda doira aylanasi uzunligi, ikkinchi qatorda doira yuzasi
#include <stdio.h>
int main() {
double PI = 3.14, r = 0;
scanf("%lf", &r);
printf("%.3f\n%.3f", 2 * PI * r, PI * r * r);
return 0;
}
def main():
PI = 3.14
r = float(input())
print(f"{2 * PI * r:.3f}")
print(f"{PI * r ** 2:.3f}")
if __name__ == '__main__':
main()
Masala C
Balandligi va asosidan kelib chiqib uchburchak yuzini hisoblaydigan dastur tuzing.
Uchburchak balandligi va uning asosi 1 dan 1000 gacha.
Uchburcha yuzi 2 xona aniqlikda
#include <stdio.h>
int main() {
int h, a;
scanf("%d %d", &h, &a);
printf("%.2f", h * a / 2.0f);
return 0;
}
def main():
h = int(input())
a = int(input())
print(f"{h * a / 2:.2f}")
if __name__ == '__main__':
main()
Masala D
Kiritilgan to’g’ri to’rtburchak tomonlaridan foydalanib uning perimetri va yuzasini hisoblaydigan dastur tuzing.
To’g’ri to’rtburchak tomonlari 1 dan 1000 gacha bo’shliq bilan ajratilgan holda
Uning perimetri va yuzasi bo’shliq bilan ajratilgan holda
#include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
printf("%d %d", 2 * (a + b), a * b);
return 0;
}
def main():
a, b = map(int, input().split())
print(2 * (a + b), a * b)
if __name__ == '__main__':
main()
Masala E
5 dan 9 gacha bo’lgan sonlardan 5 ni ayiradigan dastur tuzing.
5 dan 9 gacha bo’lgan son
Kiritilgan sondan 5 ni ayirgandagi qiymat
,-----.