test1.1
#include<stdio.h> int main() { printf(" o \n"); printf("<H>\n"); printf("I I\n"); printf(" o \n"); printf("<H>\n"); printf("I I\n"); return 0; }
test1.2
#include<stdio.h> int main() { printf(" o o\n"); printf("<H> <H>\n"); printf("I I I I\n"); return 0; }
test2
#include<stdio.h> int main() { float a, b, c; scanf_s("%f%f%f", &a, &b, &c); if (a + b > c&& b + c > a&& a + c > b) printf("能构成三角形"); else printf("不能构成三角形"); return 0; }
test3
#include<stdio.h> int main() { char ans1, ans2; printf("预习了没"); ans1 = getchar(); getchar(); printf("\n实践了没"); ans2 = getchar(); if (ans1 == 'y' || 'Y' && ans2 == 'y' || 'Y') printf("good"); else printf("666"); return 0; }
test4
#include<stdio.h> int main() { double x, y; char c1, c2, c3; int a1, a2, a3; scanf("%d%d%d", &a1, &a2, &a3); printf("a1 = %d, a2 = %d, a3 = %d\n", a1, a2, a3); scanf("%c%c%c", &c1, &c2, &c3); printf("c1 = %c, c2 = %c, c3 = %c\n", c1, c2, c3); scanf("%lf,%lf", &x, &y); printf("x = %lf, y = %lf\n", x, y); return 0; }
test5
#include <stdio.h> int main() { int year; int sec; scanf_s("%d", &sec); year = sec / (60*60*24*365); if(sec % (60 * 60 * 24 * 365)>=(30*60*24*365)) { year += 1; } printf("10亿秒约等于%d年\n", year); return 0; }
test6.1
#include <stdio.h> #include <math.h> int main() { double x, ans; scanf_s("%lf", &x); ans = pow(x, 365); printf("%.2f的365次方: %.2f\n", x, ans); return 0; }
test6.2
#include <stdio.h> #include <math.h> int main() { double x, ans; while (scanf_s("%lf", &x) != EOF) { ans = pow(x, 365); printf("%.2f的365次方: %.2f\n", x, ans); printf("\n"); } return 0; }
test7
#include<stdio.h> int main() { double f; double c; while (scanf_s("%lf", &c) != EOF) { f = 9 * c / 5 + 32; printf("摄氏度c=%.2f时,华氏度f=%.2f", c, f); } return 0; }
test8
#include<stdio.h> #include<math.h> int main() { double a, b, c, s,area; while (scanf_s("%lf%lf%lf", &a, &b, &c) != EOF) { s = (a + b + c) / 2; area = sqrt(s * (s - a) * (s - b) * (s - c)); printf("a =%.0f,b=%.0f,c=%.0f,area=%.3f", a, b, c,area); } return 0; }
标签:main,%.,return,int,实验,printf,include From: https://www.cnblogs.com/lycxt/p/17745772.html