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
omeli [17]
3 years ago
14

program that reads numbers from scanf (keyboard) and then sums them, stopping when 0 has been entered. Construct three versions

of this program, using the while, do-while, and for loops.
Computers and Technology
1 answer:
Alex17521 [72]3 years ago
7 0

Answer:

Explanation:

I'm going to write three examples in C language:

int main() {

   int n, i, sum = 0;

   printf("Enter the number: ");

   scanf("%d", &n);

   for (i = 1; i <= n; ++i) {

       sum += i;

   }

   printf("Sum = %d", sum);

   return 0;

}

int main() {

   int n, i, sum = 0;

   printf("Enter a number: ");

   scanf("%d", &n);

   i = 1;

   while (i <= n) {

       sum += i;

       ++i;

   }

   printf("Sum = %d", sum);

   return 0;

}

int main() {

   int n, i, sum = 0;

   do {

       printf("Enter a number: ");

       scanf("%d", &n);

   } while (n <= 0);

   for (i = 1; i <= n; ++i) {

       sum += i;

   }

   printf("Sum = %d", sum);

   return 0;

}

You might be interested in
A user is having trouble signing in to the domain from a computer that has been out of service for several months, and nobody el
Pepsi [2]

Answer:

To solve the problem, first,

a) The computer account should be reset.

b) Deactivate the computer from the domain.

c) Then, rejoin it to the domain.

Explanation:

A domain is a network that  allows different computers to function and operate from a common server. A domain may or may not be protected by a password. Setting up a domain provides additional security thereby blocking other computer networks from having access to it. When a person is experiencing difficulties in logging into a domain, there are certain things to be done to resolve the issue.

First, reset the computer account.

Secondly, deactivate the computer from the domain.

Third, Rejoin it back to the domain.

5 0
3 years ago
Compare and contrast between first and second generation of computer<br>​
noname [10]
Frist gen of computers took forever to load and would crash if someone els in the house picked up the phone now adays are computers are in our pockets. There our phones and they rarely if ever crash
8 0
3 years ago
Please help!!!!
alex41 [277]




Hi pupil here is your answer :::




➡➡➡➡➡➡➡➡➡➡➡➡➡



Your question :》 Which options are available when a user modifies a recurring appointment? check all that apply.


The answer is => A Open this occurenceand the option D Open the series are the option that shows from the dailog box that shows when attempting to modify the appointments .




⬅⬅⬅⬅⬅⬅⬅⬅⬅⬅⬅⬅⬅




Hope this helps .........
8 0
3 years ago
When creating and modifying templates, which keys are used to add placeholders?
beks73 [17]

Answer:

On the Slide Master tab, click Insert Placeholder, and then click the type of placeholder that you want to add. Click a location on the slide layout, and then drag to draw the placeholder. You can add as many placeholders as you like. (For Power point) But not sure about a short cut for it. Hope this helps!

3 0
3 years ago
Read 2 more answers
Jim maintains attendance records for his employees for the year row B includes the dates of attendance and columns A includes th
never [62]

lock:row\A

set:row\b

this is the correct answer

3 0
4 years ago
Other questions:
  • 3. If the typical balance on Lucy's credit card is $750 and the interest rate (APR) on her credit card is 16%, how much in inter
    11·2 answers
  • Which of the following can you use to attach external hardware devices to a computer?
    11·2 answers
  • write a program with total change amount as an integer input and output the change using the fewest coins, one coin type per lin
    8·1 answer
  • What kind of attack allows for the construction of LDAP statements based on user input statements, which can then be used to acc
    7·1 answer
  • Which of the following is the correct financial function that returns the periodic payment for a loan?
    10·1 answer
  • Breaking down a problem to find the solution is called:
    8·1 answer
  • Where is the BIOS stored?<br><br> CPU<br> CMOS<br> RAM<br> Northbridge
    13·2 answers
  • What are examples of Table Tools options that can help edit data?
    15·2 answers
  • What are the characteristics of Instant Search in Outlook 2016? Check all that apply. A)Typing whole phrases makes your search m
    12·1 answer
  • What to do if you click on a phishing link on iphone
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!