Responsive Ads Here

Thursday, November 20, 2014

ARRAY minimum to maximum

ARRAY minimum to maximum

 

//min to maxxxx
 
#include<stdio.h>
main()
{
    int a[100],i,j,n,temp=0;
    printf("\"enter N=\"");
    scanf("%d",&n);
 
    for(i=0; i<n; i++)
    {
        printf("a[%d]=",i);
        scanf("%d",&a[i]);
    }
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            if(a[i]>a[j])
            {
                temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
    }
    for(i=0; i<n; i++)
    {
        printf("%d\n",a[i]);
    }
}

No comments:

Post a Comment

php4

<?php    // Start the session  session_start();  ?>  <!DOCTYPE html>  <html>  <head>       <link rel=&q...