A customer in the Personalised Gift Store is awarded a prize when their bill number is a 3-digit number and all the 3 digits in the number are even.
Write a program to identify the prize winners.
Input Format:
Input consists of a number which corresponds to the bill number.
Output Format:
The output consists of a string that is either 'yes' or 'no'. The output is yes when the customer receives the prize and is no otherwise.
Sample Input 1:
565
Sample Output 1:
no
Sample Input 2:
620
Sample Output 2:
yes
Sample Input 3:
66
Sample Output 3:
no
Program Code:
#include<stdio.h>
int main()
{
int num,units,hundreds,tens;
scanf("%d",&num);
if(num>99 && num<1000)
{
units=num%10;
num=num/10;
tens=num%10;
hundreds=num/10;
if(units%2==0 && tens %2==0 && hundreds%2==0)
{
printf("yes");
}
else
{
printf("no");
}
}
else
{
printf("no");
}
return 0;
}
Post A Comment:
0 comments: