0% found this document useful (0 votes)
63 views3 pages

#Include Int Int Int

This C program finds the largest number from a set of input numbers. It takes the number of elements n as input, then takes n number inputs and stores them in an array. It initializes the first element as the largest number. It then loops through the array, comparing each element to the current largest, and updates the largest if a bigger number is found. Finally, it prints the largest number found.

Uploaded by

ganesh4u_p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views3 pages

#Include Int Int Int

This C program finds the largest number from a set of input numbers. It takes the number of elements n as input, then takes n number inputs and stores them in an array. It initializes the first element as the largest number. It then loops through the array, comparing each element to the current largest, and updates the largest if a bigger number is found. Finally, it prints the largest number found.

Uploaded by

ganesh4u_p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Simple program of c find the largest number

#include<stdio.h>
int main()
{
int n,num,i;
int big;
printf("Enter the values of n: ");
scanf("%d",&n);
printf("Number %d",1);
scanf("%d",&big);
for(i=2;i<=n;i++){
printf("Number %d: ",i);
scanf("%d",&num);
if(big<num)
big=num;
}
printf("Largest number is: %d",big);
return 0;
}
Sample Output:
Enter the values of n:
Number 1: 12
Number 2: 32
Number 3: 35
Largest number is: 35

#include
#include
int main()
{
int n,num,big
;
printf("Enter the length of array:- ");
scanf("%d",&n);
int a[n],i,j;
for(i=0;i<n;i++)
{
printf("\n a[%d]=",i);
scanf("%d",&a[i]);
}
big=a[0];
for(i=1;i<n;i++)
{
if(big<a[i])
{
big=a[i];
}
}
printf("greater no:-%d",big);
return 0;
}
Delete element from an array
#include <stdio.h>
int main()
{
int array[100], position, c, n;
printf("Enter number of elements in array\n");
scanf("%d", &n);
printf("Enter %d elements\n", n);
for ( c = 0 ; c < n ; c++ )
scanf("%d", &array[c]);
printf("Enter the location where you wish to delete element\n");
scanf("%d", &position);

if ( position >= n+1 )


printf("Deletion not possible.\n");
else
{
for ( c = position - 1 ; c < n - 1 ; c++ )
array[c] = array[c+1];
printf("Resultant array is\n");

for( c = 0 ; c < n - 1 ; c++ )


printf("%d\n", array[c]);

return 0;
}

You might also like