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
Question Workspace Check My Work Copying computer software, video games, movies, or music without paying the producer for them i
Tcecarenko [31]

Answer:

Option B, CUSTOMER MISBEHAVIOR.

Explanation:

Consumer misbehavior can defined as the behavioral acts by consumers which violate the generally accepted norms of conduct in consumption situations, and disrupt the order expected in such situations. Misbehavior by consumers disrupts the openness, impersonal trust, and orderliness of the exchange environment.

Some of the examples of customer misbehavior are: shoplifting, bending rules, breaking rules by ignoring warnings and using products in forbidden or ways not recommended...

* Routinized response behaviour is a type of purchasing scenario whereby the purchaser of a product or a service has past experience with purchasing it and automatically makes the decision to purchase again.

* Psychological influences refers to the workings of the mind or psyche that influences customer decisions.

* Social influences refers to the intentional and unintentional efforts to change another person's beliefs, attitudes, or behavior.

Therefore, the option that best suits the question is option B, CUSTOMER MISBEHAVIOR.

3 0
3 years ago
By applying styles,____ formats are being applied each time?
Ray Of Light [21]
(A) the same, by applying styles the same formats are being applied each time.
8 0
3 years ago
By default, the document has a (blank) margin on all four sides
Brut [27]
The normal margin is 1 inch on all sides
6 0
3 years ago
Read 2 more answers
A(n) ____ is a secure, private path across a public network that is set up to allow authorized users private, secure access to t
yKpoI14uk [10]
It's VPN(Virtual Private Network). It allows company to have private network at the same time secure. While others are not that secure.
4 0
3 years ago
Answer in python code:
katovenus [111]

Answer:

a

Explanation:

sxcvbnm,mnbvcxzzdfghjkjhgfdssd54567uhgft

7 0
2 years ago
Other questions:
  • A media file refers to what kind of file? A. Clip art
    8·2 answers
  • A new company starts up but does not have a lot of revenue for the first year. Installing anti-virus software for all the compan
    11·1 answer
  • DeShawn uses Google Ads. He wants to enable website call conversion tracking so he can see how his current ad campaign is drivin
    12·1 answer
  • In what year did the manager and team depicted in the blockbuster film "Moneyball
    9·1 answer
  • In an array based implementationof a queue a possible solution to dealing with the full condition is to
    14·1 answer
  • What is the model for 2017 Ford Mustang v6
    15·1 answer
  • 8. What do you believe: should husbands make decisions for their wives.
    5·1 answer
  • Open excel program then use the (IF) function to fill the column of (Expensive/Cheap) then save your
    9·1 answer
  • What are five types of applications you can create in Visual Basic 2017?
    12·2 answers
  • Everyone within a company needs to be aware of what data can do to improve business processes and how to make it happen. Which c
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!