answersLogoWhite

0


Best Answer

Without Using Arrays

Program:

#include<stdio.h>

main()

{

int n,m,i,max;

printf("How many numbers(n) you going to enter:");

scanf("%d",&n);

printf("Enter the numbers:");

scanf("%d",&m);

max=m;

for(i=2;i<=n;i++)

{

scanf("%d",&m);

if(m>max)

max=m;

}

printf("The Largest Number is %d",max);

}

Output:

How many numbers(n) you going to enter:5

Enter the numbers:

25

410

362

5

56

The Largest Number is 410

With Using Arrays

Program:

#include<stdio.h>

#include<conio.h>

void main()

{

int max_num(int a[],int n);

int max,i,n;

int a[50];

clrscr();

printf("Enter n number:");

scanf("%d",&n);

printf("Enter the numbers:");

for(i=0;i<n;i++)

scanf("%d",&a[i]);

max=max_num(a,n);

printf("The largest number is %d",max);

getch();

}

int max_num(int a[],int n)

{

int i,m=0;

for(i=0;i<n;i++)

{

if(a[i]>m)

m=a[i];

}

return m;

}

output:

Enter n number:10

Enter the numbers:

123

456

789

963

852

147

5

56

600

753

The largest number is 963

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to find the largest of n numbers in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

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

program to find maximum of two numbers using pointers


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


Write a C plus plus program and flow chart to find the largest of the 3 numbers?

To find the largest of three numbers, first find the largest of two numbers: int max (int x, int y) { return x&lt;y?y:x; } Now you can use this one function to find the largest of three numbers: int max (int x, int y, int z) { return max (max (x, y), z); }


Write a Shell program to find the smallest number from a set of numbers?

k


How to write a program that ask user to enter numbers until user enter- 0 then find the biggest of entered numbers in C programming using while or do while?

int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i&gt;largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);


How do you write a c program to find largest of 3 numbers using pointers?

Find the largest of two, then find the largest of that value and the third value. int* max (int* a, int* b) { return (a*) &gt; (b*) ? a : b; } int* max_of_three (int* a, int* b, int* c) { return max (max (a, b), c); }


What is the largest prime no that is stored in 8 bit pattern?

Write your own prime number program and find out.


Write a program to find the product of two numbers using Halving and Doubling method?

i need this answer


Write a C program to find the square of two numbers?

Please visit http://talentsealed.blogspot.com/2009/10/to-find-sqaure-of-numbers-using-c.htmlfor the answer.


Write a C program to find the sum of all prime numbers?

Since there is an infinite set of prime numbers the answer would be infinity.


Write a c plus plus program to find the largest among three numbers using ternary operators?

R = (A &gt; B &amp;&amp; A &gt; C) ? A : (B &gt; C) ? B : C; // parentheses not necessary - for clarity only