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
Natali5045456 [20]
2 years ago
12

Write a program that asks the user to enter a series of single digit numbers with nothing separating them. Read the input as a C

-string or a string object. The program should display the sum of all the single-digit numbers in the string. For example, if the user enters 2514, the program should display 12, which is the sum of 2, 5, 1, and 4. The program should also display the highest and lowest digits in the string.
Computers and Technology
1 answer:
vladimir2022 [97]2 years ago
4 0

Answer:

#include <stdio.h>

#include <string.h>

int main(){

   char number[100];

   printf("Number: ");

   scanf("%s", number);

   int sum = 0;

   for(int i =0;i<strlen(number);i++){

       sum+= number[i] - '0';

   }

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

   return 0;

}

Explanation:

This declares a c string of 100 characters

   char number[100];

This prompts user for input

   printf("Number: ");

This gets user input

   scanf("%s", number);

This initializes sum to 0

   int sum = 0;

This iterates through the input string

   for(int i =0;i<strlen(number);i++){

This adds individual digits

       sum+= number[i] - '0';

   }

This prints the calculated sum

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

   return 0;

You might be interested in
Describe your WGU program, including two specific requirements that this degree has for completion.
Pavlova-9 [17]

Answer:

WGU program, including two specific requirements that this degree has for completion is explained below in details.

Explanation:

WGU is an online academy with profession joined bachelor's and master's degrees in—IT, education, marketing, and healthcare—intended to support working professionals fit an online academy learning into their hard-working lives.

As a scholars, graduate pupils must register in at least eight competency units every term, and undergraduate pupils must register in at least twelve competency units respectively term.

3 0
2 years ago
If an ARQ algorithm is running over a 40-km point-to-point fiber optic link then:
Dennis_Churaev [7]

Answer and Explanation:

Given data:

Distance (D) = 40 KM

Speed of light in the fiber =Distance/ speed of light in the fiber

a) Delay (P) = Distance/ speed of light in the fiber

= (40,000 Meters/2×108 m/s)

=( 40×103 Meters/2×108 m/s)

Propagation delay (P) = 0.0002 seconds or 200 microseconds

b)

if propagation delay is 0.0002 Seconds roundup trip time (RTT) will be 0.0004 Seconds or 400 micro Seconds

Essentially since transmission times and returning ACKs are insignificant all we really need is a value slightly greater than 0.0004 seconds for our timeout value.

c)

The obvious reasons would be if the data frame was lost, or if the ACK was lost. Other possibilities include extremely slow processing on the receive side (late ACK).

Or Extremely Slow Processing of the ACK after it is received back at the send side.

4 0
3 years ago
Will give brainliest
Alex73 [517]

Answer:

B

Explanation:

Im a 100% sure.

5 0
2 years ago
To discover how many cells in a range contain values that meet a single criterion, use the ___ function
alexandr402 [8]

Answer:

COUNTIF

Explanation:

the Countif function counts the number of cells in range that meets a given criteria.

6 0
2 years ago
This is used to copy information from cell to cell in the spread sheet
Kryger [21]

Answer:

D. Fill handle

Explanation:

Required

Which can be used to copy from cell to cell

(a); Means the current cell being selected in the spreadsheet program

(b): Used to fit all columns in the spreadsheet program. Usually, the columns are fitted based on their width.

(c): The vertical and horizontal lines that separate cells.

(d): This is used to copy from one cell to another, especially adjacent cells.

5 0
3 years ago
Other questions:
  • Gloria needs to show in spreadsheet form the number of students in her class who speak different languages. Which type of graph
    7·1 answer
  • Why is it important to know much time you spend on task
    8·1 answer
  • Which online resource is usually not free?
    10·2 answers
  • There is an application which inputs hundred numbers from the user, if user enters a positive number it increments valid numbers
    6·1 answer
  • Which of these is not the correct method for moving text in a document in Word 2016?
    14·2 answers
  • What is output? Select all that apply.
    15·1 answer
  • Write assembly programs with the following I/O
    15·1 answer
  • What is an example of a recent development in technology
    11·2 answers
  • Anyone want to play mine mincraft w/ me?
    9·1 answer
  • A(n) ________ address is the address that external entities use when communicating with your network.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!