Greatest of three numbers using conditional operator in C program
C program for finding Greatest of 3 numbers using conditional operator. The questions may be asked for this C program is, write a c program to find greatest of 3 numbers using conditional operator & write a program for biggest of 3 numbers in C using conditional operator. It is an useful C program for beginners.Largest of 3 numbers using conditional operator
Find biggest of three numbers using conditional operator in C. It is used to find the biggest number by using conditional operator like and, or, not and not by using conditional statements.
C program for finding Greatest of 3 numbers using conditional operator. The questions may be asked for this C program is, write a c program to find greatest of 3 numbers using conditional operator & write a program for biggest of 3 numbers in C using conditional operator. It is an useful C program for beginners.Largest of 3 numbers using conditional operator
Find biggest of three numbers using conditional operator in C. It is used to find the biggest number by using conditional operator like and, or, not and not by using conditional statements.
//Header files
# include <stdio.h>
# include <conio.h>
void main()
{
//Program variables
int value1,value2,value3,b;
clrscr(); //Function used to clear previous output
printf("Enter first value : "); //Display function
scanf("%d",&value1); //Getting input value
printf("Enter second value : ");
scanf("%d",&value2);
printf("Enter third value : ");
scanf("%d",&value3);
b = ((value1>value2)&&(value1>value3)?value1:(value2>value3?value2:value3));
printf("greatest number is %d",b);/* Statement with conditional operator */
getch();
}
# include <stdio.h>
# include <conio.h>
void main()
{
//Program variables
int value1,value2,value3,b;
clrscr(); //Function used to clear previous output
printf("Enter first value : "); //Display function
scanf("%d",&value1); //Getting input value
printf("Enter second value : ");
scanf("%d",&value2);
printf("Enter third value : ");
scanf("%d",&value3);
b = ((value1>value2)&&(value1>value3)?value1:(value2>value3?value2:value3));
printf("greatest number is %d",b);/* Statement with conditional operator */
getch();
}
No comments:
Post a comment
Note: only a member of this blog may post a comment.