Showing posts with label BIGGEST OF 3 NUMBERS. Show all posts
Showing posts with label BIGGEST OF 3 NUMBERS. Show all posts

Wednesday, March 11, 2015

Biggest of 3 numbers

Algorithm
Step 1 : Start
Step 2 : Read values of a, b and c
Step 3 : If a > b and a > c then
Print "A is the biggest"
Step 3.1 : else if b > c then
Print "B is the biggest "
Step 3.2 : else
Print "C is the biggest"
Step 4 : Stop

Program (big3.sh)
# Biggest using logical expression
echo -n "Give value for A B and C: "
read a b c
if [ $a -gt $b -a $a -gt $c ]
then
echo "A is the Biggest number"
elif [ $b -gt $c ]
then
echo "B is the Biggest number"
else
echo "C is the Biggest number"
fi

Tuesday, January 13, 2015

BIGGEST OF 3 NUMBERS

PROGRAM:

#include<stdio.h>
main()

{
int a,b,c;

printf("Enter 3 Numbers\n"); scanf("%d%d%d",&a,&b,&c); if(a>b)

{

if(a>c)

{

printf("The First Number %d(a) is Biggest\n",a);

}

}

else if(b>c)

 {
printf("The Second Number %d(b) is Biggest\n",b);

}
else

printf("The Third Number %d(c) is Biggest\n",c);
}




OUTPUT:

Enter 3 Numbers 5 9 2


The Second Number 89(b) is Biggest