answersLogoWhite

0


Best Answer

#include<stdio.h> #include<conio.h>

main()

{

int a,b,c;

clrscr();

printf("enter the values of a,b,c");

scanf("%d,%d,%d",&a,&b,&c);

if(a>b)

{if (a>c)

{

printf("a is big");

}

else

{

printf("c is big");

}

}

else

{

if (b>c)

{

printf("b is big");

}

else

{

printf("c is big");

}

}

printf("a=%d/nb=%d/nc=%d",a,b,c);

getch();

}

/*or you can make it in another way*/

#include<stdio.h>

main()

{

int a,b,c;

printf("enter the values of a:");

scanf("%d",&a);

printf("enter the values of b:");

scanf("%d",&b);

printf("enter the values of c:");

scanf("%d",&c);

if(a>b)

{if (a>c)

{

printf("a is big");

}

else

{

printf("c is big");

}

}

else

{

if (b>c)

{

printf("b is big");

}

else

{

printf("c is big");

}

}

return 0;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

#include<iostream .h> #include<conio .h> void main() { int a, b, c; clrscr(); cout< <"Enter 3 no\n"; cin>>a>>b>>c; int big; if( a > b ) big = a; else { if( b > c ) big = b; else big = c; } cout< <"\nBiggest is: "<<big; getch(); }

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char *argv[]){int n, numList[3];

int returnval = 0;

if(argc == 4){for(n = 0; n < 3; n++){numList[n] = atoi(argv[n + 1]);}

printf("the biggest one is %i.\n", biggestInt(numList));}else{printf("Gimme three numbers.\n");

returnval = 1;}

return returnval;}

int biggestInt(int *list, int listSize){ int biggest;

if(listSize < 1) return 0;

listSize--;

biggest = list[listSize];

do{listSize--;

if(list[listSize] > biggest) biggest = list[listSize]; }while(listSize >= 0);

return biggest;}

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

To find the largest of three values you first need to find the largest of two values and then compare that value with the third value. To achieve this we need a function (conventionally named "max"):

int max (const int a, const int b) {

return (a > b) ? a : b;

}

That is, if a is greater than b, return a, otherwise return b.

To find the greatest of three values, x, y and z:

int largest = max (max (x, y), z);

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c program to find the maximum of three numbers using parameter passing?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Different parameter passing methods with examples?

explain parameter passing methods c program


What is a parameter passing?

Passing parameters probably means passing a parameter into a function.Basically, this happens when you call a function. You put the parameter into a function, then call it, and the function does something to the parameters you put into it. Here's an example: #include &lt;iostream&gt; using namespace std; int sum(int a, int b); //Declare the function, so the program knows that it exists int main() { int first, second, total; cout&lt;&lt;"Please insert two numbers."&lt;&lt;endl; cin&gt;&gt;first&gt;&gt;second; total=sum(first, second); /*Here we are passing the variables (parameters) "first" and "second" into the function "sum". This function then does something to them and outputs the value. In this case, it is stored in the variable "total"*/ cout&lt;&lt;"Their sum is "&lt;&lt;total&lt;&lt;"."&lt;&lt;endl; return 0; } //Here we define the function (tell the program what to do) int sum(int a, int b) { //We pass two integers into the function. Their values are stored in a and b. a and b can then be used by the function. sum=a+b; return sum;//Adds them, then returns the sum }


Why is string type array used in the parameter of the main method?

A user can run a program from the operating system command line, passing parameters. For example, in the case of a Java program: Java MyClass John Doe 1 2 3 In this example, the program "Java.exe" receives all the parameters starting with "MyClass" - a total of 6 parameters in this example. Then, the JVM runs the class "MyClass", and this class receives the remaining five parameters - as an array of strings. You can pass any information to a program this way; for example, a program that processes files might receive the file name, or a directory (folder) name as a parameter.


Write a Program in lisp to find maximum of three numbers?

(defun max3 (a b c) (cond ((&gt; a b) (cond ((&gt; a c) a) (t c))) ((&gt; b c) b) (t c) ) )


Write a c program to sort three integer numbers using nested if statement?

// HI THIS IS MAYANK PATEL /*C Program to find Maximum of 3 nos. using Nested if*/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int a,b,c; // clrscr(); printf("Enter three number\n\n"); scanf("d%d",&amp;a,&amp;b,&amp;c); if(a&gt;b) { if(a&gt;c) { printf("\n a is maximum"); } else { printf("\n c is maximum"); } } else { if(b&gt;c) { printf("\n b is maximum"); } else { printf("\n c is maximum"); } } getch(); }

Related questions

Different parameter passing methods with examples?

explain parameter passing methods c program


Why and when should programmers use a constant reference parameter?

when we use that parameter as a global parameter and we used that parameter through out the program without changing


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


What is a parameter passing?

Passing parameters probably means passing a parameter into a function.Basically, this happens when you call a function. You put the parameter into a function, then call it, and the function does something to the parameters you put into it. Here's an example: #include &lt;iostream&gt; using namespace std; int sum(int a, int b); //Declare the function, so the program knows that it exists int main() { int first, second, total; cout&lt;&lt;"Please insert two numbers."&lt;&lt;endl; cin&gt;&gt;first&gt;&gt;second; total=sum(first, second); /*Here we are passing the variables (parameters) "first" and "second" into the function "sum". This function then does something to them and outputs the value. In this case, it is stored in the variable "total"*/ cout&lt;&lt;"Their sum is "&lt;&lt;total&lt;&lt;"."&lt;&lt;endl; return 0; } //Here we define the function (tell the program what to do) int sum(int a, int b) { //We pass two integers into the function. Their values are stored in a and b. a and b can then be used by the function. sum=a+b; return sum;//Adds them, then returns the sum }


Why is string type array used in the parameter of the main method?

A user can run a program from the operating system command line, passing parameters. For example, in the case of a Java program: Java MyClass John Doe 1 2 3 In this example, the program "Java.exe" receives all the parameters starting with "MyClass" - a total of 6 parameters in this example. Then, the JVM runs the class "MyClass", and this class receives the remaining five parameters - as an array of strings. You can pass any information to a program this way; for example, a program that processes files might receive the file name, or a directory (folder) name as a parameter.


What program did JFK succeed in passing?

The Peace Corp was the program that JFK was successful in passing.


Error message invalid parameter. What is the valid parameter?

Generally speaking it is an error in the web page or program design which is trying to tell the computer to do something that is 'invalid'. The invalid parameter message is usually followed by a short blurb telling you what line the error is on.


How do you run multiple instances of Skype?

Start the Skype program (skype.exe) with the parameter /secondary eg: c:\program files\skype\mobile\skype.exe /secondary


How do you read the dll file within the aspnet program which the dll file is used to pass parameter between aspnet program?

Question need some more clarification


What is the maximum age for joining The Initiates Program?

There is no maximum age limit for joining The Initiates Program. However the minimum age limit is 15.


What command line parameter will prevent a program executed using runas.exe from accessing the elevated user's encrypted files?

/noprofile


What command with all options and parameter will send the signal USR1 to any executing process of program apache2?

killall -10 apache2