#include<stdio.h>
void main()
{
int x[5],i,j,temp;
for(i=0;i<=4;i++)
{
printf("Enter x[%d]th number : ",i);
scanf("%d",&x[i]);
}
for(i=0;i<=5-2;i++)
{
for(j=i+1;j<=5-1;j++)
{
if(x[i]>x[j])
{
temp=x[i];
x[i]=x[j];
x[j]=temp;
}
}
}
printf("\nIn Ascending Order : ");
for(i=0;i<=4;i++)
{
printf("%d ",x[i]);
}
printf("\nIn Descending Order : ");
for(i=4;i>=0;i--)
{
printf("%d ",x[i]);
}
getch();
}
Related Posts:
Simple quiz in C#include<stdio.h>
#include<conio.h>
#include <windows.h>
#include<ctype.h>
#include<stdlib.h>
#include<time.h>
#include<dos.h>
void displayscore()
{
char name[20];
… Read More
Check if 3rd digit of a no. is prime or not in C ?#include<stdio.h>
int digitcount(int x)
{
int r,c=0,i=0,y=x;
while(x!=0)
{
r=x%10;
x=x/10;
c+… Read More
Application of struct in C#include<stdio.h>
#include<string.h>
struct student
{
char name[20];
int roll;
};
void main()
{
struct student s[10],t;
int i,n,j;
printf("Enter no. of students : "… Read More
Check if a string is palindrome or not in C ?#include<stdio.h>
#include<string.h>
void main()
{
char word[50];
int i,j,l,c=0;
printf("Enter a word : ");
gets(word);
l=strlen(word);
… Read More
Graphics in C#include <windows.h>
#include <stdio.h>
void SetColorAndBackground(int ForgC, int BackC);
void main()
{
int f,b;
system("cls");
printf("Enter … Read More
0 comments:
Post a Comment