C

Thursday, 7 September 2017

Program To Find Smallest And Biggest Number In Array Of Integer Numbers

#include<stdio.h>
main()
{
int a[20],n,i,big,small;
clrscr();
printf("\nEnter Total Numbers You Want In Array : ");
scanf("%d",&n);
printf("\nEnter The %d Integer Numbers\n",n);
for(i=0;i<=n;i++)
scanf("%d",&a[i]);
big=a[0];
for(i=0;i<=n;i++)
if(a[i]>big)
big=a[i];
printf("\nThe Largest Number In Array Is : %d",big);
small=a[0];
for(i=0;i<=n;i++)
if(a[i]<small)
small=a[i];
printf("\nThe Smallest Number Is: %d",small);
return(0);
}


No comments:

Post a Comment

Write a program to draw a circle using mid-point circle drawing algorithm.

#include<iostream.h> #include<graphics.h> #include<conio.h> void drawcircle(int x0, int y0, int r) {         ...