{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software) for windows 7 like Code::Blocks,dev c++ . Download dev c++ its free and install it in your computer.open dev c++ go to file-->new-->source file.}
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,j,a[100],t;
printf("enter the number of elements(only<100) \n ");
scanf("%d",&n);
printf("enter the numbers\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("number in ascending order is\n");
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>=a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
printf("%d\n",a[i]);
}
getch();
}
For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}
No comments:
Post a Comment