This program is about convert and print the given string in ascending order using for loops.
#include <stdio.h> #include <string.h> int main() { char str[100],ch; int i,j,l; printf("Input the string : "); fgets(str, sizeof str, stdin); l=strlen(str); /* sorting process */ for(i=1;i<l;i++) { for(j=0;j<l-i;j++) { if(str[j]>str[j+1]) { ch=str[j]; str[j] = str[j+1]; str[j+1]=ch; } } } printf("Result : \n"); printf("%s\n\n",str); return 0; }To download raw file Click Here
Input the string : TUTORJOES Result : EJOORSTTU
Learn All in Tamil © Designed & Developed By Tutor Joes