1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
charle [14.2K]
3 years ago
15

Write a program named as reverse.c that reads a message, then prints the reversal of the message. The output of the program shou

ld 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;
Computers and Technology
1 answer:
Gre4nikov [31]3 years ago
5 0

Explanation:

#include <stdio.h>

#define N  20

int main()

{

   char str[N];

   char reverse[N];

   int c;

   int i;

   int j;

   int k;

   int flag=0;

   printf("Enter a string: ");

   i=0;

   j=0;

   while((i<N)&&((c=getchar())!='\n')){

       str[i] = c;

       i++;

   }

   k=i;

   while((j<=k)&&(i>=0)){

       reverse[j]=str[i];

       j++;

       i--;

       flag=1;

   }

   i=0;

   while(i<=k){

       putchar(reverse[i]);

       i++;

   }

   return 0;

}

  • The first while loop will read the string character wise.
  • while((i<N)&&((c=getchar())!='\n')) : This statement will check whether it has reached the end of the line or the specific number of characters are reached.
  • 2nd file loop will reverse the string and transfer to another array.
  • Third loop will print the reversed string.
You might be interested in
What type of code do computers typically use to operate? A. CSS B. HTML 5 C. HTML D. Binary
Ugo [173]

Answer:

D. Binary

Explanation:

Computer hardware parts are built on transistors, small electrical devices that switch electrical signals and amplify power. The CPU (Central Processing Unit), the "brain" of the computer, has billions of tiny transistors <em>alone</em>.

These transistors read binary, a code made up of 1's and 0's. This code tells what the computer to do.

CSS, HTML, and HTML 5 apply to web pages and web page designs, not code for the computer.

The OS (operating system) that your computer runs is coded in C++ (Windows) or C (Linux)

4 0
3 years ago
It’s important to consider adjusting a user’s social network permissions (or access) because
Liula [17]
<span>You may not want to share access to social networks with other members of your team. Also you may want to adjust your users social permission for security reasons, just to be on the safe side. A stronger network means you have a lower chance of a hacker breaking through your system.</span>
5 0
3 years ago
How do u set up a Wi-Fi network on Android ​
AlladinOne [14]

Answer:

These are some way I know

5 0
3 years ago
What is cell address?​
Nat2105 [25]

Answer:

A cell reference, or cell address, is an alphanumeric value used to identify a specific cell in a spreadsheet. Each cell address contains “one or more letters” followed by a number. The letter or letters identify the column and the number represents the row.

Explanation:

3 0
3 years ago
Which of the following statements is true? 1. The Internet is just a network of computers. 2. The internet is now an Internet of
lisabon 2012 [21]

Answer:

All statements are true

Explanation:

  1. The internet is a network of globally interconnected millions of computers that communicate wit themselves remotely using standardized communication protocols via a web server.
  2. The internet is also refer to as internet of things (IoT)as devices and gadgets in homes and cars can now be connected to the internet with the exchange of billions of information using cheap processors and WLAN
  3. Everything on IoT needs an Internet Protocol address (like an house address) to function and exchange data.
  4. It must be be able to exchange information with other inter-connected devices for it to be an IoT.
7 0
4 years ago
Other questions:
  • What does subscribing to a website’s RSS feed provide to a subscriber?
    10·1 answer
  • What ip address cidrs are not allowed to be communicated with by our malware?
    15·1 answer
  • How do you choose the amount of points you give a person here on this brainless app...??.
    11·2 answers
  • You work on a team whose job is to understand the most sought after toys for the holiday season. A teammate of yours has built a
    11·1 answer
  • GPS data can be used to track the rate and direction of plate movement. If a GPS unit measures a latitude velocity of 28.2 mm/yr
    8·1 answer
  • All computer systems have
    14·2 answers
  • A computer follows step-wise instructions to complete any task which is known as?
    5·1 answer
  • 9. These particular machines can be decentralized.
    9·1 answer
  • A small business named Widgets, Inc. has hired you to evaluate their wireless network security practices. As you analyze their f
    13·1 answer
  • A DSS8440 server is equipped with one power supply that is failing and requires replacement. What is the correct sequence of ste
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!