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
lesya692 [45]
2 years ago
9

1.21 lab: divide by x write a program using integers user_num and x as input, and output user_num divided by x three times. ex:

if the input is:_________
Computers and Technology
1 answer:
ad-work [718]2 years ago
6 0

A program using integers user_num and x as input, and output user_num divided by x three times is given below:

<h3>The Program</h3>

#include <stdio.h>

int main(void) {

  int userNum;

  int x;

  int ans1;

  int ans2;

  int ans3;

 

  scanf("%d", &userNum);

  scanf("%d", &x);

 

  ans1 = userNum/x;

  ans2 = ans1/x;

  ans3 = ans2/x;

 

  printf("%d %d %d\n", ans1, ans2, ans3);

  return 0;

}

Read more about programming here:

brainly.com/question/23275071

#SPJ1

You might be interested in
You must _____ the recording of the macro when you have completed the tasks it was designed to do
Julli [10]
You must stop the recording.
8 0
3 years ago
In this assignment, you will write a complete C program that will act as a simplecommand-line interpreter (i.e., a shell) for th
jolli1 [7]

Answer:

/ to access the input scanf()

// and output printf()

#include <stdio.h>  

// to access the functions like

// pipe(), fork(), execvp(), dup2()

#include <unistd.h>  

// to access the string functions like

// strtok()

#include <string.h>

// to access function wait()

#include <sys/wait.h>

#include <stdlib.h>

int main()

{

  // declare a variable to hold the process id

  pid_t p_id;

  // declare a variable to hold the index value

  int array_index;

  // declare the string to hold the user input

  // as command

  char userIn_Command[128];

  // use a continuous loop

  while (1)

  {

      // display the prompt for the user

      printf("minor5> ");

      // read the input from the user

      scanf("%[^\n]", userIn_Command);

      // check the condition that whether the user

      // inputs a command called "quit"

      // If the user inputs quit command then exit from

      // the script

      if (strcmp(userIn_Command, "quit") == 0)

      {

          printf("\n");

          break;

      }

      // if there are any usage of pipelining or redirection

      // display the error message and exit from the script

      if (strchr(userIn_Command, '|') != NULL || strchr(userIn_Command, '>') != NULL ||

          strchr(userIn_Command, '<') != NULL)

      {

          printf("Error: Cannot perform the multiple command operations or directions\n");

          break;

      }

      // declare the variables to hold the process

      int p_pids[2];

      // create the system call to pipe() from kernal

      // and display the error message

      if (pipe(p_pids) < 0)

      {

          printf("Error: Pipe creation failed!\n");

      }

      // create the child process

      p_id = fork();

      // condition to check whether the fork() is

      // created. If so, display an error message

      if (p_pids < 0)

      {

          printf("Error: fork() failed!\n");

          break;

      }

      // if the child process is created

      if (p_id == 0)

      {

          // close pipe in child process

          close(p_pids[0]);

          // create duplicate of the standard output

          dup2(p_pids[1], STDOUT_FILENO);

          // close the pipe in child process

          close(p_pids[1]);

          // declare a variable to store path

          // to execute the command

          char *command_path;

          // declare an array of string to hold the options

          char * args[32];

          // tokenize the command by using the delimiter at " "(single space)

          char *cmd_token = strtok(userIn_Command, " ");

          // store the token value

          command_path = cmd_token;

          args[0] = cmd_token;

          array_index = 1;

          // loop until all the options in the command are

          // tokenized

          while (1)

          {

              // get the next token

              cmd_token = strtok(NULL, " ");

              // condition to check whether the token is null

              // or not

              if (cmd_token == NULL)

              {

                  break;

              }

              // store the token if it is not null

              args[array_index] = cmd_token;

              // increment the index

              array_index++;

          }

          // last parameter to the command should be NULL */

          args[array_index] = NULL;

                     

          /* calling exec function with command path and parameters */

          if (strcmp(args[0], "cd") == 0 || strcmp(args[0], "history") == 0 ||

              strcmp(args[0], "exit") == 0)

          {

              printf("%s: Command not found\n", args[0]);

              break;

          }

          if (execvp(command_path, args) < 0 )

          {

              printf("%s: Command not found\n", args[0]);

              break;

          }

      }

      else

      {          

          /* closing writing end of pipe in parent process */

          close(p_pids[1]);

          /* reading ouput written to pipe in child process and

          * writing to console */

          while (1)

          {

              char output[1024];

              int n = read(p_pids[0], output, 1024);

              if (n <= 0)

              {

                  break;

              }

              output[n] = '\0';

              printf("%s", output);

          }

          /* closing read end of pipe1 */

          close(p_pids[0]);

          /* waiting until child process complete its execution */

          wait(NULL);

      }

      /* skipping newline character read while scanf() */

      getchar();

  }

  exit(0);

}

Explanation:

7 0
3 years ago
What is an example of using the Internet of Things (IoT) to deliver innovative Cloud based solutions to customers?
VladimirAG [237]

An example of using the Internet of Things (IoT) to deliver innovative Cloud-based solutions to customers is: A. wearable technology that provides customers with on-the-spot personalized experiences.

<h3>What is cloud computing?</h3>

Cloud computing can be defined as a Cloud-based solutions that typically requires the use of shared computing resources over the Internet, rather than using local servers, wired-connection and hard drives to provide various services to customers.

In Computer technology, a good example of an application of the Internet of Things (IoT) to deliver innovative Cloud-based solutions to end users is wearable technology that is designed and developed to provide users with on-the-spot personalized experiences.

Read more on cloud computing here: brainly.com/question/19057393

#SPJ1

<u>Complete Question:</u>

What is an example of using the Internet of Things (IoT) to deliver innovative Cloud-based solutions to customers?

A. wearable technology that provides customers with on-the-spot personalized experiences

B. scheduled conferences with brand ambassadors to pitch customers on new offers

C. customers using a PC connected to a local network to search for recommendations

D. online surveys that gather customer input to improve services in the future

E. I don't know this yet.

8 0
2 years ago
Question 10 of 10
AnnyKZ [126]

Answer:

Explanation:B.

just took the test

3 0
3 years ago
________ is a programming language invented by netscape used to control the objects on an html page and handle interactions with
spayn [35]
The answer is JavaScript
5 0
3 years ago
Other questions:
  • One governing factor when determining the minimum size of conduit to be used is the 
    9·2 answers
  • Technology will not? A. change the way work is done B. process information faster C. slow the pace of work D. link companies and
    8·1 answer
  • One example of a Microsoft Store app is Select one: a. Photos. b. Paint. c. File Explorer. d. Notepad.
    10·1 answer
  • IMPORTANT!!<br><br> How can you get real answer keys for edmentum (plato) courses as a student?
    11·1 answer
  • give the difference between functional and functional tools in the middle of to the circle give importance​
    10·1 answer
  • Write three statements to print the first three elements of vector runTimes. Follow each with a newline. Ex: If runTimes = {800,
    8·1 answer
  • Given the message size of 16Kb, packet size of 2Kb, speed of 4Kbps over 3 links, how much time, will it take the message to trav
    6·1 answer
  • The pH scale is_____ ?
    5·1 answer
  • PLS HELP I GOT 30 MINS TO TURN THIS IN!!!
    7·2 answers
  • Can’t be opened because apple cannot check it for malicious software.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!