Untitled
unknown
c_cpp
3 years ago
2.8 kB
5
Indexable
#include <stdio.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #define M_PI 3.14159265358979323846 int main() { /* Зад 2 for (int i = 1; i < 11; i++) { for (int a = 0; a < i; a++) { printf("*"); } printf("\n");; } */ /*Зад 3 char symbol; scanf_s("%c", &symbol); for (int i = 0; i < 10; i++) { printf("%c",symbol); } printf("\n"); for (int b = 0; b < 3; b++) { for (int i = 0; i < 10; i++) { if (i == 0 || i == 9) { printf("%c", symbol); } else { printf(" "); } } printf("\n"); } for (int i = 0; i < 10; i++) { printf("%c", symbol); } */ /* Зад 5 printf("Enter inches: "); int inch; scanf_s("%d", &inch); float cm = inch * 2.54f; printf("CM: %f\n", cm); float mm = inch * 25.4f; printf("MM: %f\n", mm); float dm = inch * 0.254f; printf("DM: %f\n", dm); */ /*Зад 6 float temp; scanf_s("%f", &temp); float fahrenheit = temp * 1.8f + 32; printf("Fahrenheit: %f", fahrenheit); */ /*Зад7 float grad; scanf_s("%f", &grad); float rad = (grad * M_PI) / 180; printf("Rad: %f", rad); */ /*Зад 8 printf("Leva: "); int leva; scanf_s("%d", &leva); float dollar = leva * 2.54f; printf("Dollar: %f\n", dollar); float eu = leva * 0.58f; printf("EU: %f\n", eu); float paund = leva * 0.43f; printf("Paund: %f\n", paund); */ /*Зад 9 int a; scanf_s("%d", &a); int b; scanf_s("%d", &b); int c; scanf_s("%d", &c); float s = (a + b) * c / 2; printf("S: %f\n", s); */ /*Зад 10 float deg; scanf_s("%f", °); double sinOfDeg = sin(deg); double cosOfDeg = cos(deg); double tanOfDeg = tan(deg); double cotanOfDeg = 1 - tan(deg); printf("Sin: %f\n", sinOfDeg); printf("Cos: %f\n", cosOfDeg); printf("Tan: %f\n", tanOfDeg); printf("Cotan: %f\n", cotanOfDeg); */ /*Зад14 double price_fruit, price_veg; scanf_s("%lf %lf", &price_fruit, &price_veg); int kg_fruit, kg_veg; scanf_s("%d %d", &kg_fruit, &kg_veg); double price_fruit_lv = price_fruit * kg_fruit; double price_veg_lv = price_veg * kg_veg; double price_fruit_eu = price_fruit_lv * 1.95f; double price_veg_eu = price_veg_lv * 1.95f; printf("Fruit: %.3lf\n", price_fruit_eu); printf("Veg: %.3lf", price_veg_eu); */ /* Зад 16 int n; scanf_s("%d", &n); double m; scanf_s("%lf", &m); double salary = n * m; double bonus = 2.5f * salary; double total_without_taxes = salary + bonus; double total = total_without_taxes - (total_without_taxes * 0.25f); double m_without_taxes = total / n; printf("Amount for a day without taxes: %lf", m_without_taxes); */ return 0; }
Editor is loading...