01 Feb 2010 @ 8:50 PM 

A C program for arranging elements of user entered array in ascending or descending order and finding minimum and maximum value among all.

How to copy the code in your notepad

In order to copy this code move your cursor to upper right corner of the post a source button will appear click on it and copy the code.

#include<stdio.h>
 #include<conio.h>
 void main() {
 int n[10],i,j,t,max,min;
 clrscr();
 for (i=0;i<10;i++) {
 printf("\n   Enter the %d number: ",i+1);
 scanf("%d",&n[i]);
 }
 for (i=0;i<20;i++) {
 for (j=i+1;j<10;j++) {
 t=n[i];
 if (n[i]>n[j]) {
 n[i]=n[j];
 n[j]=t;
 }
 }
 }
 max=n[0];
 min=n[0];
 for (i=0;i<20;i++) {
 if (max<n[i])
 max=n[i];
 if (min>n[i])
 min=n[i];
 }
 printf("\n   The sorted array is as follow: \n");
 for (i=0;i<5;i++) {
 printf("%d\n",n[i]);
 }
 printf("\n   The max value in the array is: %d",max);
 printf("\n   The min value in the array is: %d",min);
 getch();
 printf("\n\n\n   Copyright {EZOEC ISOC}");
 printf("\n\n   Press any key to exit the program...");
 getch();
 }
Posted By: EzoecIsoc
Last Edit: 01 Feb 2010 @ 10:27 PM

EmailPermalink
Tags


blog comments powered by Disqus

 Last 50 Posts
Change Theme...
  • Users » 55
  • Posts/Pages » 5
  • Comments » 0
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Welcome



    No Child Pages.

Blog



    No Child Pages.