กิจกรรมที่ 2 ตรรกะและเงื่อนไข
ตัวอย่างโปรแกรม 1
#include<stdio.h>
main()
{
float score=10;
if(score>=10)
printf("You Pass");
else
printf("Not Pass");
}
ตัวอย่างโปรแกรม 2
#include<stdio.h>
main()
{
float score=10;
if(score>=15)
printf("Good");
else if(score>=10)
printf("Fair");
else
printf("Not Pass");
}
ตัวอย่างโปรแกรม 3
#include<stdio.h>
main()
{
float score;
printf("Enter your score ==>");
scanf("%f",&score);
if(score>=15)
printf("Good");
else if(score>=10)
printf("Fair");
else
printf("Not Pass");
}