Pages

Sunday 20 May 2012

program to print the elements in Array and find out maximum number


93./*Write a program to print the elements in Array and find out maximum number*/

#include<stdio.h>
#include<conio.h>
void main()
{
int arr[10];
int i,temp;
clrscr();
printf("enter the elements in the array:\n");
for(i=0;i<10;i++)
{
scanf("%d",&arr[i]);
}
temp=arr[0];
for(i=1; i<10 ; i++)
{
if(temp<arr[i])
temp=arr[i];
}
printf("The maximum numbers : %d",temp);
getch();
}


OUTPUT


            Enter the elements in the array:
            4
            2         
            9
            6
            7         
            5
            8
            3
            2
            1

            The maximum number is: 9

No comments:

Post a Comment