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]
3 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]3 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
For computer forensics, ____________ is the task of collecting digital evidence from electronic media.
Zanzabum

For computer forensics, <u>data acquisition</u> is the task of collecting digital evidence from electronic media.

<h3>What is data acquisition?</h3>

Data acquisition is the process of gathering digital evidence from electronic media for computer forensics. Static acquisitions and live acquisitions are the two different categories of data acquisition.

You learn how to carry out static acquisitions from digital material in this chapter. It is the process of digitalization of data from the world.

Thus, <u>data acquisition</u> is the task of collecting digital evidence from electronic media.

To learn more about data acquisition, refer to the link:

brainly.com/question/28233320

#SPJ4

7 0
2 years ago
The main differences between laptops and desktop computers other than size and portability.
e-lub [12.9K]

Answer:

Difference between laptops and desktop computer are:

  • Desktop computers contain wide variety of components, but laptops are realtively expensive than desktop computers because laptop has high speed and better graphics designs which increased the cost of whole system.
  • Desktop computer processors are larger in size and it is more efficient and powerful as compared to laptops because laptop processor still has some limitations.
  • Laptop uses less power as compared to desktop computer because laptop contain small components and that is why it needs less power.
  • Desktop computers are easy to upgrade and in laptops hard drive and memory, these two components needs to be upgraded.

5 0
3 years ago
What kind of software is Microsoft Outlook??
NNADVOKAT [17]

Answer:

Email software

Explanation:

8 0
3 years ago
Read 2 more answers
Which of the following best describes the purpose of a design specification?
snow_lady [41]

Answer:

it is.    Describing the requirements for how a program will work or users will interact with it

Explanation:

mark brainlist

6 0
3 years ago
Read 2 more answers
Windows stores information from the Credential Manager application in secure folders called
Delicious77 [7]

Windows stores information from the Credential Manager application in secure folders called<u> VAULTS.</u>

<u></u>

Explanation:

  • A credential vault is a database used to store passwords and similar cryptographic key material.
  • The most common data stored in a credential vault are current and historical passwords to privileged accounts.
  • All credentials are saved in special folders on the computer, a place called Vaults. Moreover, you can back up all credentials to a file and restore them on to different computer.
  • Vault is a shareware program that acts as a bank vault, or safe, where you can keep you private information or files hidden and secure.
  • Everything in the vault is protected with an advanced encryption, and requires a password (your password) to open the vault to access the information.
8 0
3 years ago
Other questions:
  • This program will output a right triangle based on user specified height triangle_height and symbol triangle_char. (1) The given
    9·1 answer
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • Which are valid double statements for java? double a = 0; double b = -1.0; double c = -425; double d = 6340; double e = -1.0; do
    12·2 answers
  • Which is the best description of the difference between bound and unbound forms? O Bound forms are similar to hierarchical forms
    7·1 answer
  • The merge sort algorithm sorts using what technique?
    8·1 answer
  • What icons in the toolbar change the look of the presentation text? It’s either Drawing, Formatting,Presentation, or Standard
    9·2 answers
  • What is the positional weigh of the digit 7 in the octal number 7642 ?​
    15·1 answer
  • 4.2 Lesson Practice​
    8·2 answers
  • Now that you have explored several different languages (Python, HTML, CSS, and JavaScript), what can you do to keep straight whi
    7·1 answer
  • Write the implementation of a class Cse20 Topic that represents a topic in the cse20 class. The class should implement the init
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!