Program:
#include<stdio.h>
//#include<conio.h>
void main()
{
int a[100],i,j,n,t;
printf("Enter the number of elements: ");
scanf("%d",&n);
printf("\nInput the elements\n");
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<n;i++)
{
for(j=1;j<=n-i;j++)
{
if(a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
printf("After sorting: \n");
for(i=1;i<=n;i++)
{
printf("%d ",a[i]);
}
printf("\n");
// getch();
}
Output:
nn@linuxmint ~ $ gcc c6.c
nn@linuxmint ~ $ ./a.out
Enter the number of elements: 5
Input the elements
5
4
3
2
1
After sorting:
1 2 3 4 5
nn@linuxmint ~ $
#include<stdio.h>
//#include<conio.h>
void main()
{
int a[100],i,j,n,t;
printf("Enter the number of elements: ");
scanf("%d",&n);
printf("\nInput the elements\n");
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<n;i++)
{
for(j=1;j<=n-i;j++)
{
if(a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
printf("After sorting: \n");
for(i=1;i<=n;i++)
{
printf("%d ",a[i]);
}
printf("\n");
// getch();
}
Output:
nn@linuxmint ~ $ gcc c6.c
nn@linuxmint ~ $ ./a.out
Enter the number of elements: 5
Input the elements
5
4
3
2
1
After sorting:
1 2 3 4 5
nn@linuxmint ~ $
Great Content. It will useful for knowledge seekers. Keep sharing your knowledge through this kind of article.
ReplyDeleteNode JS Training in Chennai
Perl Training in Chennai
Nice blog! Thanks for sharing this valuable information
ReplyDeleteAngularjs Training in Bangalore
Angularjs classes in pune
Angularjs Training in hyderabad
Angularjs Training in Gurgaon
Angularjs Training in delhi
This post is so interactive and informative.keep updating more information...
ReplyDeleteArtificial Intelligence Course in Mumbai
Artificial Intelligence Course in Ahmedabad
Artificial Intelligence Course in Kochi
Artificial Intelligence Course in Trivandrum
Artificial Intelligence Course in Kolkata
ReplyDeleteGet inspired by your blog. Keep doing like this....
Spoken English Classes in Bangalore
Spoken English Classes in Pune
spoken english centre in Hyderabad
English Speaking Course in Gurgaon
English speaking course in Delhi
This post is so helpfull and informative.keep updating with more information...
ReplyDeleteSwift Developer Training In Mumbai
Swift Developer Certification Training In Ahmedabad
Swift Developer Certification Training In Kochi
Swift Developer Certification Training In Trivandrum
Swift Developer Training In Kolkata
ReplyDeleteNice post Thank for sharing
DevOps Online Training
DevOps Training in Chennai
DevOps Training in Bangalore
slot siteleri
ReplyDeletekralbet
betpark
tipobet
mobil ödeme bahis
betmatik
kibris bahis siteleri
poker siteleri
bonus veren siteler
KOHX
great Post.
ReplyDeleteCCNA classees in Pune
Are you eager to embark on a transformative journey into the world of web development? Look no further! Our comprehensive web development courses in Kochi offer not only top-notch learning but also an exclusive opportunity for a free internship.
ReplyDeleteYou explained the topic very well. The content has provided meaningful information thanks for sharing. intresting to gain knowledge then checkout our blog full stack course in pune
ReplyDeleteشركة تنظيف بأحد رفيدة
ReplyDeleteشركة تنظيف
Elevate your skills with our Best Mern Stack Course In South Delhi , a carefully structured program that aims to impart a comprehensive understanding of full-stack web development through the MERN technology.
ReplyDelete