Docsity

C Program to Print Entered Alphabets in Descending Order based on ASCII Codes, Study Guides, Projects, Research of Java Programming

Toggle sidebar
bg1
TASK:11
OBJECTIVE:
Write a C program that will print the entered alphabets in their descending
order by using their ASCII codes.
SOURCE CODE:
//Name:Syed Hassam Badar
//Section:B
//Form No:EL-042-2018
#include<conio.h>
#include<stdio.h>
void main(void)
{
clrscr();
char arr[5],temp;
int a,b;
for(a=0;a<=4;a++)
{
printf("\nEnter the Letter=");
arr[a]=getche();
}
for(a=0;a<=4;a++)
{
for(b=a+1;b<=4;b++)
{
if(arr[a]<arr[b])
{
temp=arr[a];
arr[a]=arr[b];
arr[b]=temp;
}
}
}
printf("\nThe descending order is");
for(a=0;a<=4;a++)
{
printf("\n%c",arr[a]);
}
getche();
}
OUTPUT:

Partial preview of the text

Download C Program to Print Entered Alphabets in Descending Order based on ASCII Codes and more Study Guides, Projects, Research Java Programming in PDF only on Docsity!

TASK:

OBJECTIVE:

Write a C program that will print the entered alphabets in their descending order by using their ASCII codes.

SOURCE CODE:

//Name:Syed Hassam Badar //Section:B //Form No:EL-042- #include<conio.h> #include<stdio.h> void main(void) { clrscr(); char arr[5],temp; int a,b; for(a=0;a<=4;a++) { printf("\nEnter the Letter="); arr[a]=getche(); } for(a=0;a<=4;a++) { for(b=a+1;b<=4;b++) { if(arr[a]<arr[b]) { temp=arr[a]; arr[a]=arr[b]; arr[b]=temp; } } } printf("\nThe descending order is"); for(a=0;a<=4;a++) { printf("\n%c",arr[a]); } getche(); }

OUTPUT: