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)


Write a program to input two numbers and print their number and square?

Here's a simple Python program that takes two numbers as input and prints each number alongside its square: # Input two numbers num1 = float(input(&quot;Enter the first number: &quot;)) num2 = float(input(&quot;Enter the second number: &quot;)) # Print each number and its square print(f&quot;Number: {num1}, Square: {num1**2}&quot;) print(f&quot;Number: {num2}, Square: {num2**2}&quot;) This program uses the input function to read numbers, converts them to floats, and then calculates and displays their squares.


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.

Trending Questions
What does a Java Boolean type variable declared but not yet initialized contain when its class is instanciated? Is the Great Wall of China the only man-made structure that can be seen from space? An instrument that magnifies small objects so that they can be seen easily by using two or more lenses? What else could the furniture company do or make with the scrap used to make your puzzle cube? What the magnitude of the impedance of a series AC circuit w resistance of 6 Ω an inductive reactance of 17 Ω and zero capacitive reactance? What you can do to ensure the system continues to meet the knowledge workers need? Where are shut off valves? When did alexander graham bell invent the machine that could clean wheat? Why are there warm spots on the floor? Assembly language program to find the largest of series of numbers in 8051? Is hydrofoil pneumatic or hydraulic? What you the current in an ac circuit with 120 volts and a 60 watt light bulb? How does building on a flood plain cause flooding? How do you seal gas flue from furnace? What are true statements about HTML? How do you increase land under cultivation? What effect will blocked flue have on the boiler? Write a program to find the sum of squares of n natural numbers using c plus plus? Differences between hydraulic and non hydraulic cement? JavaScript is the dynamic scripting language in web browsers It is typically embedded in HTML documents to be interpreted by the browser for client side processing It was also used as a server side?