Write a program to input two number and find smallest number.
In this program we input two number and check which number is smallest. For this, we give a condition As:- If 1st number is smallest then print 1st number else 2nd number is smallest and print 2nd number.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter 1st number=");
scanf("%d",&a);
printf("Enter 2nd number=");
scanf("%d",&b);
if(a<b)
printf("\n1st number is smallest");
else
printf("\n2nd number is smallest");
getch();
}
OUTPUT
Enter 1st number=7
Enter 2nd number =10
1st number is smallest
Related Examples
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter 1st number=");
scanf("%d",&a);
printf("Enter 2nd number=");
scanf("%d",&b);
if(a<b)
printf("\n1st number is smallest");
else
printf("\n2nd number is smallest");
getch();
}
OUTPUT
Enter 1st number=7
Enter 2nd number =10
1st number is smallest
Related Examples
- Write a program to input a number and check number is positive or not.
- Write a program to input a number and check number is negative or not.
- Write a program to input a number and check number is positive,negative or nuteral.
- Write a program to input two number and find highest number.
Follow for recently updates ,Share and Comment.
Comments
Post a Comment