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

Write a (java) program with a class called Sum1, using a while loop to add 10 numbers entered from the key-board.

Computers and Technology
1 answer:
Ainat [17]3 years ago
5 0

This is a java program with a class called Sum1.

Explanation:

While loop is used to add 10 number.

import java.util.Scanner;

public class Sum 1

{

   public static void main(String args[])

   {

       int number, count, sum = 0;

       Scanner s = new Scanner(System.in);

       System.out.print("Enter the number:");

       number = s.nextInt();

       while(number > 0)

       {

           count = number % 10;

           sum = sum + n;

           number = number / 10;

       }

       System.out.println("Sum of Digits:"+sum);

   }

}

You might be interested in
Match the element of a presentation program to its description
lana [24]

Answer:

A) Array of buttons for<u> quick access </u>to commonly used <u>commands and tools</u>: Tool bar

That's what most people will use most of the time, to quickly perform the most common tasks.

B) <u>List of commands</u> to create, format and edit presentations: Menu Bar.

When the features listed in the tool bar aren't enough, we go to the Menu system, which lists all the features of the program.

C) <u>Provides info</u> about current slide<u> at the bottom</u> of the slide: Status Bar.

The status bar is always located at the <u>bottom of the screen</u>.

D) <u>Provides navigation</u> through the slides: Scroll bar.

Where you can scroll down and up your slides.

4 0
3 years ago
In c please
Paraphin [41]

Answer:

#include <stdio.h>

#include <ctype.h>

void printHistogram(int counters[]) {

   int largest = 0;

   int row,i;

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

       if (counters[i] > largest) {

           largest = counters[i];

       }

   }

   for (row = largest; row > 0; row--) {

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

           if (counters[i] >= row) {

               putchar(254);

           }

           else {

               putchar(32);

           }

           putchar(32);

       }

       putchar('\n');

   }

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

       putchar('a' + i);

       putchar(32);

   }

}

int main() {

   int counters[26] = { 0 };

   int i;

   char c;

   FILE* f;

   fopen_s(&f, "story.txt", "r");

   while (!feof(f)) {

       c = tolower(fgetc(f));

       if (c >= 'a' && c <= 'z') {

           counters[c-'a']++;

       }

   }

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

       printf("%c was used %d times.\n", 'a'+i, counters[i]);

   }

   printf("\nHere is a histogram:\n");

   printHistogram(counters);

}

5 0
2 years ago
Lindsay owns a candy store that typically makes all of its sales to tourists visiting a nearby zoo. Why might she decide to set
umka2103 [35]
Social media is so powerful in this generation because it is able to reach many different corners of the world. It is not only used merely for communication but also sometimes or most of the times for business. For Lindsay, the use of social media will allow her to increase the size of the customer base. The answer is letter A. 
4 0
3 years ago
Read 2 more answers
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
my internet is really slow. i've tried rebooting my computer, erasing history, etc. how can i fix this problem?
Bingel [31]
Did u shut it down and then reset it????? Did you unplug your internet adapter????
3 0
3 years ago
Read 2 more answers
Other questions:
  • Why do objects in the back seat move when the car turns
    11·1 answer
  • On other questions, how do I write my own question, without commenting on others questions? It is only allowed two, I think, the
    13·1 answer
  • Which asynchronous electronic community is also known as a forum?
    9·2 answers
  • A text file has been transferred from a Windows system to a Unix system, leaving it with the wrong line termination. This mistak
    15·1 answer
  • What is "the last mile of broadband access"? Why is this a problem and what kind of impact does it have on the business world an
    9·1 answer
  • How to program a game​
    7·2 answers
  • The 60-watt light bulb has a 400 hour life expectency how much will it cost to operate during its time
    14·1 answer
  • Python code 100 Random Numbers (twice)
    9·1 answer
  • 3. Special keys labelled Fl to F12.
    8·1 answer
  • 100 POINTS. DO NOT SPAM. OR I WILL REPORT.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!