Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- int A, no, counter = 0, same = -1, i;
- int va[] = {10, 20, 30, 40, 50};
- int n = sizeof(va) / sizeof(int);
- printf("点数を入力してください。\n");
- scanf("%d", &A);
- for (i = 0; i < n; i++) {
- printf("%d: %d, ", i + 1, va[i]);
- if (A > va[i]) counter++;
- if (A == va[i]) same = i;
- }
- puts("");
- printf("あなたは下から%d番目です。\n", counter + 1);
- printf("あなたは上から%d番目です。\n", n - counter + ((same >= 0) ? 0 : 1));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement