Write a program named as reverse.c that reads a message, then prints the reversal of the message. The output of the program should look like this: Enter a message: Don ’t get mad, get even. Reversal is : .neve teg ,dam teg t ’noD Hint: Read the message one character at a time (using getchar) and store the characters in an array. Stop Reading when the array is full or the character read is ‘\n’. The framework of reverse.c is as below: /* reverse.c */ #include #define N 50 int main(){ int arr[N],i=0; char ch; printf("Enter a message: "); /* Put code here to get input from user by using getchar() */ printf("Reversal is: "); /* Put code here to print out the reversal by using putchar()*/ printf("\n"); return 0; }
Write a
Enter a message: Don ’t get mad, get even. Reversal is : .neve teg ,dam teg t ’noD
Hint: Read the message one character at a time (using getchar) and store the characters in an array. Stop Reading when the array is full or the character read is ‘\n’.
The framework of reverse.c is as below:
/* reverse.c */ #include #define N 50 int main(){ int arr[N],i=0; char ch; printf("Enter a message: "); /* Put code here to get input from user by using getchar() */ printf("Reversal is: "); /* Put code here to print out the reversal by using putchar()*/ printf("\n"); return 0; }
![Hint: Read the message one character at a time (using getchar) and store the characters in an
array. Stop Reading when the array is full or the character read is '\n'.
The framework of reverse.c is as below:
/* reverse.c */
#include<stdio.h>
#define N 50
int main() {
int arr [N],i=0;
char ch;
printf("Enter a message: ");
/* Put code here to get input from user by using getchar() /
printf("Reversal is: ");
/* Put code here to print out the reversal by using putchar () */
printf ("\n");
return 0;](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3138459a-b3f3-4868-a0e9-e822dbdecb92%2F98356405-598b-4901-93d6-97d8a92a1f12%2Foygy5fq_processed.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images









