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
What are the restrictions of a modulus operator?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is the purpose of main( ) in c language?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
How can I automatically locate a programs configuration files in the same directory as the executable?
How important is structure in life?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What are the advantages of Macro over function?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
How can you determine the maximum value that a numeric variable can hold?
Is there a built-in function in C that can be used for sorting data?
Can you please compare array with pointer?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
Where are local variables stored in c?
In C programming, how do you insert quote characters (‘ and “) into the output screen?