Write a program that reads 6 words, separated by spaces and then displays them in a line, but in reverse order. The words are stored in 6 variables M1, ..., M6.
Example:
here is a small sentence !
! sentence small a is here
Difficulty level
Video recording
This exercise is mostly suitable for students
#include <stdio.h>
int main()
{
char M1[30], M2[30], M3[30], M4[30], M5[30], M6[30];
printf("Enter 6 word, separated by spaces :\n");
scanf ("%s %s %s %s %s %s", M1, M2, M3, M4, M5, M6);
printf("%s %s %s %s %s %s\n",M6, M5, M4, M3, M2, M1);
return 0;
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Binary heaps