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;
}
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: