
August 31st, 2012, 12:51 AM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 1
Time spent in forums: 23 m 5 sec
Reputation Power: 0
|
|
|
Error showing in dev c++ ple solve
To write a program to perform sorting operation using bubble sort technique( data structure c programming)
its showing error ple help
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,temp,n;
int arr[50];
printf("enter the no of elements");
scanf("%d",&n);
printf("enter elements");
for(i=0;i<n;i++)
scanf("%d",arr[i]);
for(i=0;i<=n;i++)
{
for(j=0;j<n-1;j++)
{
if (arr[j]>arr[j+1])
{
temp=arr[j]
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
printf("sorted array");
for(i=0;i<n;i++)
printf("%d",arr[i]);
getch();
return 0;
}
}
|