How to write a C program to determine the smallest among
three nos using conditional operator?
Answer Posted / 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 |
Post New Answer View All Answers
What is a const pointer?
What is meant by 'bit masking'?
What are the advantages of the functions?
What are the different types of objects used in c?
What are the 4 types of unions?
How can I find the modification date of a file?
In C language, a variable name cannot contain?
What are the advantages and disadvantages of a heap?
Why is not a pointer null after calling free?
Explain is it valid to address one element beyond the end of an array?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
Can we compile a program without main() function?
Explain what is #line used for?
What are the types of assignment statements?