#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter any three numbers");
scanf("%d%d%d",&a,&b,&c);
if(a>b&&a>c)
printf("A is greatest");
else if(b>a&&a>c)
printf("B is greatest");
else if(c>a&&c>b)
printf("C is greatest");
if(a<b&&a<c)
printf("A is smallest");
else if(b<a&&b<c)
printf("B is smallest");
else if(c<a&&c<b)
printf("C is smallest");
getch();
}
start input A & B if A>B print A is greatest if B>A print B is greatest stop james ola writes.....SOT.
1. Read the 3 nos a,b,c 2. Let larget = a 3. if b > largest then largest = b 4. if c > largest then largest = c..... If you have to process more nos, read all of them in an array. Assume the first element be largest, do comparison through all elements of the array.... Similar algorithm can be developed for finding the lowest also. /*lab practice 2 damithguruge question 4 */ #include<stdio.h> int main() { int num1,num2,num3,num4; int smallest; printf("Please enter a number1"); scanf("%d%*c", &num1); printf("Please enter a number2"); scanf("%d%*c" ,&num2); printf("Please enter a number3"); scanf("%d%*c", &num3); Printf("Please enter a numbe4r"); scanf("%d%*c", &num4); /* num1 set as the smallest */ smallest=num1; if(smallest > num2) then smallest=num2; else if smallest >num3 then smallest=num3; else if smallest>num4 then smallest=num4; printf("smallest number:%d\n,smallest"); return(0); endif endif endif }
program that take three decimal number as input and find the largest among them in assembly language
Please visit http://talentsealed.blogspot.com/2009/10/to-find-smallest-among-three-using.htmlfor answer.
To find the largest of three numbers you must first find the largest of two numbers: int max (int a, int b) { return a>b?a:b; // or, equivalently: if (a>b) return a; else return b; } Now we can use this function to find the maximum of three: int max3 (int a, int b, int c) { return max (max (a,b), c); }
Highlight the numbers and click on the sort button. You can sort ascending (smallest to largest) or descending (largest to smallest).
The average of the smallest and the largest even numbers (2 and 98) is 50 The average of the next smallest and the next largest (4 and 96) is 50 The average of the next smallest and the next largest (6 and 94) is 50 and so on. So, the overall average is 50.
The smallest of the three is 13.
The smallest of the three numbers is 22.
The smallest is 15.
The smallest is 14.
The smallest one is 100. The largest one is 999. There are 900 of them.
largest of a, b, c :a > b ? a > c ? a : c : b > c ? b : c
The smallest consecutive three numbers that total 120 are... 39, 40 & 41.
55
The smallest is 55.
Mercury, Mars and Venus. Smallest to largest.