Tutorials, Free Online Tutorials,It Challengers provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, core java, sql, php, c language etc. for beginners and professionals.

Breaking

Write a C Program to Reverse Letter in Each Word of the Entered String

Write a C Program to Reverse Letter in Each Word

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main() {
   char msg[] = "Welcome to It Challengers World";
   char str[10];
   int i = 0, j = 0;
   clrscr();
   while (msg[i] != '\0') {
      if (msg[i] != ' ') {
         str[j] = msg[i];
         j++;
      } else {
         str[j] = '\0';
         printf("%s", strrev(str));
         printf(" ");
         j = 0;
      }
      i++;
   }
   str[j] = '\0';
   printf("%s", strrev(str));
   getch();
}

Output:-
emocleW ot tI sregnellahC dlroW

No comments:

Post a Comment