
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A c program that takes user input of five alphabets and prints them in descending order based on their ascii codes. The program uses an array to store the entered characters and two nested for loops to compare and swap the characters if they are in the wrong order.
Typology: Study Guides, Projects, Research
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Write a C program that will print the entered alphabets in their descending order by using their ASCII codes.
//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(); }