there are 5 tunnels. if a person visit, tunnel 2 and 3, print gold, if he visit tunnel 4 and 5, print brass, if he visit only tunnel 4, print soil
. if he visit tunnel 1, notify wrong entry.if he enters 1 or 3 numbers, print 'wrong
Share
there are 5 tunnels. if a person visit, tunnel 2 and 3, print gold, if he visit tunnel 4 and 5, print brass, if he visit only tunnel 4, print soil
. if he visit tunnel 1, notify wrong entry.if he enters 1 or 3 numbers, print 'wrong
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Explanation:
there are 5 tunnels. if a person visit, tunnel 2 and 3, print gold, if he visit tunnel 4 and 5, print brass, if he visit only tunnel 4, print soil
. if he visit tunnel 1, notify wrong entry.if he enters 1 or 3 numbers, print 'wrong
Answer:
#include <stdio.h>
int main()
{
int x;
printf("Please enter the Tunnel Number:");
scanf("%d", &x);
if (x <1 || x>5)
{
printf("Please enter Tunnel number from 1 to 5\n");
}
if (x==2 || x==3)
{
printf("Gold\n");
}
if (x==5)
{
printf("Brass\n");
}
if (x==4)
{
printf("Soil\n");
}
if (x==1)
{
printf("Wrong Entry\n");
}
printf("End of Program");
return 0;
}