How to write a C program to determine the smallest among
three nos using conditional operator?
Answers were Sorted based on User's Feedback
Answer / sai
#include<stdio.h>
#include<conio.h>
void main()
{
int n1,n2,n3,small;
clrscr();
printf("Enter three numbers");
scanf("%d%d%d",&n1,&n2,&n3);
small=n1<n2?(n1<n3?n1:n3):(n2<n3?n2:n3);
printf("smallest number is:%d",small);
printf("press any key to close");
getch();
}
Is This Answer Correct ? | 32 Yes | 11 No |
Answer / azad sab;e,chiplun
void main()
{
int n1,n2,n3,small;
clrscr();
printf("Enter three numbers");
scanf("%d%d%d",&n1,&n2,&n3);
small=n1<n2?(n1<n3?n1:n3):(n2<n3?n2:n3);
printf("smallest number is:%d",small);
printf("press any key to close");
}
getch();
}
Is This Answer Correct ? | 24 Yes | 21 No |
for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?
What are the different types of C instructions?
write a program to display numbers from 1 to 10 and 10 to 1?
What is wrong with this statement? Myname = 'robin';
What is wrong in this statement? scanf(“%d”,whatnumber);
is compiler do read the data line by line or not. ??
6 Answers LG Soft, Satyam, Tech Mahindra,
Which are low level languages?
can we print any string in c language without using semicolon(;)(terminator) in whole program.
Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….
Explain what is the concatenation operator?
Write a program to swap two numbers without using third variable?