C Program to check whether the first nunber is between the other two numbers - IProgramX

Q. Write a program to accept three numbers and check whether the first is between the other two numbers



Program

#include<stdio.h>
int main()
{
int x,y,z;
printf("enter 3 numbers : ");
scanf("%d%d%d",&x,&y,&z);
if(x>=y && x<=z)
printf("%d is between %d and %d",x,y,z);
else
printf("%d is not between %d and %d",x,y,z);
}

Output:

enter 3 numbers : 20 10 30
20 is between 10 and 30

Post a Comment

0 Comments