76 974
Assignments Done
Successfully Done
In June 2019

Answer to Question #23650 in C++ for Joni

Question #23650
(Sum of digits) Make a program that reads a three-digit integer from the file "number.in" and then calculates sum of the digits and writes the result into the file"sum.out".Use the format of the sample output in the file "sumout".
Expert's answer
#include <fstream>
using namespace std;

int main() {
ifstream in("sum.in");
ofstream out("sum.out");
int a,c=0;
in >> a;
while (a>0) {
out << c;
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions