The program must accept two integers X and Y as the input. The program must print the last two digits of X as the output if the unit digit of X or the tenth digit of Y is even. Else the program must print the last two digits of Y as the output.
I need the program only in c language, not in c++ or java.
Answers
Answer:
The program must accept two integers X and Y as the input. The program must print the last two digits of X as the output if the unit digit of X or the tenth digit of Y is even. Else the program must print the last two digits of Y as the output.
I need the program only in c language, not in c++ or java.
In C language the program is as follows,
int main(){
int x,y,z;
scanf(“%d %d”,&x,&y);
if((x%10)%2==0 ||((y%10)/10)%2==0){
z=(x%10)/10*10+(x%10);
printf(“%d”,z);
}
else{
z=(y%10)/10*10+(y%10);
printf(“%d”,z);
}
}
This program will accept two integers X and Y as input. The program will print the last two digits of X as the output when the unit digit of X or the tenth digit of Y is even. Or else the program will print the last two digits of Y as the output.
Hence, this is the 'C' program to accept two integers X and Y as input and will print the last two digits of X as output or the tenth digit of Y if even.
#SPJ2