Computer Science, asked by preetinayak416, 3 months ago

write a c programme to find largest among n number ​

Answers

Answered by sudhanshus5694
0

Answer:

#include<stdio.h>

void main()

{

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

int max,i,n;

int a[50];

printf("Enter n number:");

scanf("%d",&n);

printf("Enter the numbers:");

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

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

max=maximum(a,n);

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

}

int maximum(int a[],int n)

{

int i,m=0;

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

{

if(a[i]>m)

m=a[i];

}

return m;

}

Explanation:

#include <stdio.h>

#include <conio.h>

int main()

{

int i,num,n,large=0;

printf("How many numbers: ");

scanf("%d",&n);

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

{

printf("\nEnter number %d: ",i+1);

scanf("%d",&num);

if(num>large)

large=num;

}

printf("\n\nThe Largest Number is %d",large);

getch();

return 0;

}

Answered by janvisaini235
3

Explanation:

#include<studio.h>

#include<conio.h>

void main

{

int x;

print f ("enter n different numbers");

scan f(" %d", &n);

if ( n1>=n2 && n1>=n3)

print f (" %d is the largest number.",n1);

if ( n2>=n1 && n2>=n3)

print f ( %d is the largest number.", n2);

if ( n3>=n1 && n3>=n2)

print f (% d is the largest number.",n3);

return 0;

}

Similar questions