answersLogoWhite

0

#include <iostream> void main() { using namespace std; int num, rem, sum=0; //Declaring variables cout<<"Enter a number :"<<endl; cin>>num; //Loop to calculate the sum of the digits of the given number. while(num!=0) { rem=num%10; num=num/10; sum=sum+rem; } cout<<"Sum of the digits is "<<sum<<endl; cin.get(); }

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

The distance between two cities in km is input through the keyboard write a program to convert and print this distance in meters feet inches and centimeters?

mesh's basic salary is input through the keyboard. his dearness allowance is 40% of basic salarying , and house rent allowance is 20% of basic salaried. write a program to calculate his gross salary


What a program of add to number in visul basic net?

In Visual Basic .NET, you can create a simple program to add two numbers by using input boxes or text fields to gather user input. For example, you would declare two variables to store the numbers, convert the input to numeric types, and then perform the addition. Finally, you can display the result using a message box or a label. Here's a basic example: Dim num1 As Integer = Convert.ToInt32(InputBox(&quot;Enter first number:&quot;)) Dim num2 As Integer = Convert.ToInt32(InputBox(&quot;Enter second number:&quot;)) Dim sum As Integer = num1 + num2 MessageBox.Show(&quot;The sum is: &quot; &amp; sum)


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


How do you create a program that can input 100 names using flowchart?

create a program that can input 100 names


Explain what you understand by a program with one example?

A program is a set of instructions written in a programming language that tells a computer how to perform specific tasks. For example, a simple calculator program can take user input for two numbers and an operation (like addition or subtraction), process that input, and then display the result. This program demonstrates how code can automate calculations and provide user-friendly interaction.

Related Questions

How do you prepare a program in basic to display the word and the number of letters in it when is given as input?

10 cls 20 input"enter word";word$ 30 print word$ 40 print len(word$) 50 end this program is for GW BASIC for other BASIC's the line numbers are optional.


What is the program that manages the data between the operation system and all input and output devices attached to the system?

basic input output system (BIOS)


How do you write BASIC program to accept variables?

dim a input a


The distance between two cities in km is input through the keyboard write a program to convert and print this distance in meters feet inches and centimeters?

mesh's basic salary is input through the keyboard. his dearness allowance is 40% of basic salarying , and house rent allowance is 20% of basic salaried. write a program to calculate his gross salary


What is the bios set up program called?

there is no bios setup program but BIOS stands for basic input output system


What program is responsible for loading the operating system into RAM?

Basic Input/Output System (BIOS)


What a program of add to number in visul basic net?

In Visual Basic .NET, you can create a simple program to add two numbers by using input boxes or text fields to gather user input. For example, you would declare two variables to store the numbers, convert the input to numeric types, and then perform the addition. Finally, you can display the result using a message box or a label. Here's a basic example: Dim num1 As Integer = Convert.ToInt32(InputBox(&quot;Enter first number:&quot;)) Dim num2 As Integer = Convert.ToInt32(InputBox(&quot;Enter second number:&quot;)) Dim sum As Integer = num1 + num2 MessageBox.Show(&quot;The sum is: &quot; &amp; sum)


What is the fundamental difference between data and and program?

The fundamental difference between data and a program lies in their roles and functions: data represents information, such as numbers, text, or images, that can be processed or analyzed, while a program is a set of instructions or code that tells a computer how to manipulate that data. In essence, data is the input that can be used or generated, and a program is the logic that performs operations on that input to produce output. Thus, data serves as the content, whereas a program serves as the methodology for processing that content.


What does program output with input mean?

Program output with input refers to the result produced by a program when it processes specific data or instructions provided as input. The output can be in various forms, such as text, numbers, or visual displays, depending on the program's purpose. Essentially, it illustrates how the program responds to the given input, demonstrating its functionality and behavior. This concept is fundamental in programming, as it helps developers understand the effects of their code and debug any issues.


Sum three real numbers using for loop in c program?

take input n chodo


How do you input an operator between two numbers in java?

You type it in with your keyboard.


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.