0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

if ①

Posted at

#include<stdio.h>

int main (void) {
	char kamoku;
	int ten;

	printf("科目を入力してください(k:国語 s:数学) > "); //
	scanf("%c", &kamoku);
	printf("点数を入力してください > ");
	scanf("%d", &ten);

	if (kamoku == 'k') {
		if (ten >= 73 && ten <= 100) {
			printf("国語の点数は平均点以上です");
		}
		else if (ten <= 0 && ten < 73) {
			printf("国語の点数は平均点以下です");
		}

		else {
			printf("点数の入力エラーです");
		}
	}
	else if (kamoku == 's') {
		if (ten >= 61 && ten <= 100) {
			printf("数学の点数は平均点以上です");
		}
		else if (ten >= 0 && ten < 61) {
			printf("数学の点数は平均点未満です");
		}
		else {
			printf("点数の入力エラーです");
		}

	}
	else {
		printf("科目の入力エラーです");


	}
	return 0;
}
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?