printf("ho_tari\n");

passFail 본문

C

passFail

호타리 2023. 9. 1. 12:02
#include <stdio.h>



int main(void)

{

	int score;

	printf("input score : ");

	scanf("%d", &score);

	

	int isPass = (score >= 60);

	printf("score : %d - pass : %d\n", score, isPass);

	

	return 0;

}

 

#include <stdio.h>



int main(void)

{

	int score;

	printf("input score : ");

	scanf("%d", &score);

	

	//int isPass = (score >= 60);

	//printf("score : %d - pass : %d\n", score, isPass);

	

	if (score >= 60)

	{

		printf("score : %d --- pass\n", score);

	}

	else

	{

		printf("score : %d --- fail\n", score);

	}

	

	return 0;

}

 

#include <stdio.h>



int main(void)

{

	int score;

	printf("input score : ");

	scanf("%d", &score);

	

	//int isPass = (score >= 60);

	//printf("score : %d - pass : %d\n", score, isPass);

	

	/*

	if (score >= 60)

	{

		printf("score : %d --- pass\n", score);

	}

	else

	{

		printf("score : %d --- fail\n", score);

	}

	*/

	

	printf("score : %d --- %s\n", score, (score >= 60) ? "pass" : "fail");

	

	return 0;

}

 

<compile 결과>

'C' 카테고리의 다른 글

pointer2  (0) 2023.09.01
pointer  (0) 2023.09.01
ordinaryLeap  (0) 2023.09.01
one2Ten  (0) 2023.09.01
oddEven  (0) 2023.09.01