How to write a C program to determine the smallest among
three nos using conditional operator?
Answer Posted / 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 |
Post New Answer View All Answers
Difference between strcpy() and memcpy() function?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is the difference between local variable and global variable in c?
What is structure packing in c?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Did c have any year 2000 problems?
What is a nested formula?
Can a pointer point to null?
How can I ensure that integer arithmetic doesnt overflow?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
When can a far pointer be used?
how to count no of words,characters,lines in a paragraph.
In which header file is the null macro defined?
What is a #include preprocessor?
Where define directive used?