Question
Asked Feb 28, 2020
68 views

In C, Given an int variable n that has already been declared, write some code that repeatedly reads a value into n until at last a number between 1 and 10 (inclusive) has been entered.

check_circle

Expert Answer

Step 1:Program code:

//include the required header file

#include <stdio.h>

 

//define main function

int main()

{

//declare the required variables

int n;

 

//prompt the user to enter the numbers

printf("Enter the number\n");

 

//iterate until user enters a number between 1 and 10(including 1 and 10)

 while ( n > 10 || n < 1 )

{

//scan for the value

scanf("%d",&n);

}

//return

return 0;

}

Step 2:Program code #1:

Computer Science homework question answer, step 2, image 1

...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Java

A: import java.util.Scanner;   public class WordProperties {                         public static void...

question_answer

Q: "What are a few things a good cyber security plan should include?

A: A good cyber security plan should include the following, A complete risk assessment of the user’s b...

question_answer

Q: Create a Crow’s Foot notation ERD to support the following business operations: A friend of yours ha...

A: The following figure illustrates the ER Diagram for given business rules in Crow’s Foot notation:

question_answer

Q: Which type of parser is more powerful, bottom-up or top-down, use as many examples as possible to su...

A: Answer: Bottom-up parser: The “LR” parser is the bottom-up manner because, they construct a parse t...

question_answer

Q: What are the advantages and disadvantages of user-defined ordinal types as data types? What are the ...

A: An ordinal type is that data type in which the range of possible values can be simply linked with th...

question_answer

Q: Find the theta notation each expression.

A: Click to see the answer

question_answer

Q: Which of the following uses copper as a communication media?     a. twisted pair     b. coax...

A: ANSWER: “e. a&amp;b above” is the answer.

question_answer

Q: Write Java code to find the lowest value in a 2 dim array.

A: Program: //include the header file import java.util.*;   //definition of main method class Main {   ...

question_answer

Q: What kind of timing problems may occur like signal delay when testing out the sequential system and ...

A: Timing problems: Sequential circuits are of two types, Synchronous circuits Asynchronous circuits ...