Jay
user_6817964
c_cpp
a year ago
2.1 kB
6
Indexable
Never
#include <iostream> int main() { //如果介在9-16 這樣9跟16算嗎??? 題目沒寫ㄟ int x, y; scanf("%d%d", &x, &y); int min = sqrt(x) + 1; int max = sqrt(y) + 1; for (int i = min; i < max; i++) { printf("%d\n", i * i); } } /* int main() { int N; int R = 0; scanf("%d", &N); if (N < 0 || N>1000000) { printf("Overflow."); } else { while (N / 10 > 0) { R = R * 10 + N % 10; N /= 10; } R = R * 10 + N; printf("%d", R); } } */ /* int main() { int s[5]; scanf("%d%d%d%d%d", &s[0], &s[1], &s[2], &s[3], &s[4]); float sum = 0; for (int i = 0; i < 5; i++) { if (90 <= s[i] && s[i] <= 100) { printf("A\n"); sum += (s[i] * 10 + s[i]); } else if (80 <= s[i] && s[i] <= 89) { printf("B\n"); sum += (s[i] * 9 + s[i] * 0.85); } else if (70 <= s[i] && s[i] <= 79) { printf("C\n"); sum += (s[i] * 7 + s[i] * 0.75); } else if (60 <= s[i] && s[i] <= 69) { printf("D\n"); sum += (s[i] * 5 + s[i] * 0.15); } else { printf("F\n"); sum += (s[i] + s[i] * 0.10); } } printf("Total scholarship : %.2f", sum); } */ /* int main() { int a[4]; scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3]); //排大小 for (int i = 0; i < 3; i++) { for (int j = i + 1; j < 4; j++) { if (a[i] < a[j]) { int index = a[i]; a[i] = a[j]; a[j] = index; } } } printf("In descending order: %d %d %d %d.\n", a[0], a[1], a[2], a[3]); //算平均 float average = (a[0] + a[1] + a[2] + a[3]) / 4.0; printf("Average is %.2f.", average); } */