#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,j,n,temp;
clrscr();
printf(“Enter
the size of arrary\n”);
scanf(“%d”,&n);
printf(“Enter
%d elements \n”);
for(i=1;i<=n;i++)
{
scanf(“%d”,&a[i]);
}
for(i=1;i<=n;i++)
{
for(j=1;j>i;j--)
{
if(a[j]<a[j-1])
{
temp=a[j];
a[j]=a[j-1];
a[j-1]=temp;
}
}
}
printf(“The
sorted Array is\n”);
for(j=1;j<=n;j++){
printf(“%d”,a[j]);
}
getch();
}
thnxx for this.looking for more articles from you. and I have collected some of the tricky programming questions from my personal experience and from my friends. Please have a review on this and i hope that it will really help you to improve your logics. :) http://csetips.catchupdates.com/tricky-programming-questions-interview/
ReplyDelete