-->
Showing posts with label else concept. Show all posts
Showing posts with label else concept. Show all posts

Write a program to know a number entered by you lies between two values/range or not

//a program to know a number entered by you lies between two values/range or not
#include<stdio.h>
#include<conio.h>
void main()
{
float n,range_v,range_v1;
printf("enter a number to check\n");
scanf("%f",&n);
printf("enter range values");
scanf("%f%f",&range_v,&range_v1);
if(n>range_v && n<range_v1)
{
printf("it lies in range");
}
else 
{
printf("it does not\n");
}
getch();
}

Write a program to know two numbers entered by you are same or not.

//program to know two numbers entered by you are same or not.
#include<stdio.h>
#include<conio.h>
void main()
{
float n,n1;
printf("enter a number\n");
scanf("%f%f",&n,&n1);
if(n==n1)
{
printf("they are equal");
}
else
{
printf("they are not");
}
getch();
}