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
Which describes the first step a crawler-based search engine uses to find information?
elena-14-01-66 [18.8K]
C is the correct answer to the problem
6 0
3 years ago
Read 2 more answers
Describe two benefits of the community of replacing the printed copy with an online version.
DiKsa [7]

Answer:

less costs

Explanation:

saves more money

easy to use for everyone

6 0
3 years ago
The identification of the technology management framework contain?
AlexFokin [52]

Answer:

Explanation:

The effective management of technology as a source of competitive advantage is of vital importance for many organizations. It is necessary to understand, communicate and integrate technology strategy with marketing, financial, operations and human resource strategies. This is of particular importance when one considers the increasing cost, pace and complexity of technology developments, combined with shortening product life cycles. A five process model provides a framework within which technology management activities can be understood: identification, selection, acquisition, exploitation and protection. Based on this model, a technology management assessment procedure has been developed, using an ``action research’’ approach. This paper presents an industrial case study describing the first full application of the procedure within a high-volume manufacturing business. The impact of applying the procedure is assessed in terms of benefits to the participating business, together with improvements to the assessment procedure itself, in the context of the action research framework. Keyword: Technology, Strategy, Management, Assessment

8 0
3 years ago
Change the screen resolution so you can view more information on your screen. Use the resolution that enables you to fit the mos
bulgar [2K]
On Windows 10, you are able to right-click the desktop, and select "Display Settings". From there you can see all attached displays that are connected to your computer. Select "Advanced display settings", and your resolution would be right there, for example, the resolution of my monitor is 3840×2160.
4 0
3 years ago
A major software corporation has decided that its operating system is too difficult for the average user. Who should they hire t
MA_775_DIABLO [31]
They should hire Timothy because he is qualified enough to make a software that could be user friendly and less difficult for people that are new to computers. <span />
3 0
3 years ago
Other questions:
  • How do networks help protect data? -by preventing access by more than one person at a time -by restricting access to department
    11·2 answers
  • DPI stands for _____.
    14·1 answer
  • Select the correct answer.
    15·1 answer
  • : What is the difference between the Audio Mixer and the<br> Audio Meters Panel?
    7·2 answers
  • Write a program that prints the day number of the year, given the date in the form month-day-year. For example, if the input is
    9·1 answer
  • Write only in C, not C++.
    14·1 answer
  • Please help can’t get a bad grade!
    12·1 answer
  • Who want a rap song if yes try to rap too this Can you move it like this? I can shake it like that
    10·2 answers
  • If one of the resistors is turned off (I.e. , a light bulb goes out), what happens to the other resistors (light bulbs) in the c
    15·1 answer
  • How can I master the computer organization ​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!