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
postnew [5]
3 years ago
5

Please develop a C program to reverse a series of integer number (read from the user until EOF issued by user) using stack ADT l

ibrary. Please include c code and three sample run demonstrations with at least 10 different numbers each time.
Computers and Technology
1 answer:
EleoNora [17]3 years ago
8 0

Answer:

#include <stdio.h>

#define MAX_CH 256

int main(void) {

int ch, i, length;

char string[MAX_CH];

for (;;) {

for (i = 0; i < MAX_CH; i++) {

if ((ch = getchar()) == EOF || (ch == '\n')) break; string[i] = ch; }

length = i;

if (length == 0) { break; }

for (i = 0; i < length; i++) { putchar(string[length - i - 1]); }

putchar('\n');

}

return 0;

}

Explanation:

  • Take input from user until the end of file.
  • Reverse the string using the following technique:
  • putchar(string[length - i - 1])
You might be interested in
A____consists of many users and their information.​
grin007 [14]

<u>Active Directory</u> consist of many users and their information.

7 0
2 years ago
Read 2 more answers
Ron wants to install an energy efficient and long lasting device for lighting in his new home. Which device should he use?
olga2289 [7]
Ron will most likely want to buy tube lights since that is a good energy saver.
4 0
4 years ago
Read 2 more answers
Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
Ratling [72]
I would imagine car would still be the best means , it's tough to define without knowing where he lives and how much he travels
8 0
3 years ago
What are the steps for inserting an internal link?
julia-pushkina [17]

Answer:

=

Worksheet

Ctrl + Enter

Explanation:

4 0
3 years ago
Read 2 more answers
Write a program using integers userNum and x as input, and output userNum divided by x four times. Ex: If the input is: 2000 2
STatiana [176]

Answer:

// here is code in c++.

// include header

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables to read input

   int userNum,x;

   cout<<"enter the value of userNum and x :";

   // read the input from user

   cin>>userNum>>x;

   // divide the userNum with x 4 times

   for(int a=0;a<4;a++)

   {

       userNum=userNum/x;

       cout<<userNum<<" ";

   }

       cout<<endl;

return 0;

}

Explanation:

Declare two variables "userNum" and "x". Read the value of these. Run a for loop 4 time and divide the "userNum" with "x" and print  the value of "userNum".

<u>Output:</u>

enter the value of userNum and x :2000 2                                                                                  

1000 500 250 125  

3 0
3 years ago
Other questions:
  • (Statistics) Write a program that includes two functions named calcavg() and variance(). The calcavg() function should calculate
    10·1 answer
  • If str 1 and str2 are both Strings, which of the following expressions will correctly
    13·1 answer
  • What is the decimal representation of the following signed binary numbers?
    6·1 answer
  • When replacing a thermostat or water pump, coolant drained from the cooling system should be ________.
    9·1 answer
  • What type of photography is represented by a photograph of a dog on a beach ?
    11·1 answer
  • Software and technology that allow people to work together on a task are known as
    8·2 answers
  • What is this?
    15·2 answers
  • Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the cou
    8·1 answer
  • How was kapilvastu named​
    11·1 answer
  • Select the correct answer.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!