MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / main3

Function main3

Lab_03/Digits.cpp:7–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <iostream>
6using namespace std;
7int main3() {
8 int a, sum = 0;
9 cout << "Please enter the number: ";
10 cin >> a;
11 while (a != 0) {
12 sum = sum + a % 10;
13 a = a / 10;
14 }
15 cout <<"The sum of digits of given number is "<< sum <<";"<< endl;
16
17 system("pause");
18 return 0;
19}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected