66 926
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #16689 in C++ for Junaid

Question #16689
Write a C++program that reads in a number N from the keyboard and then add the first N integer starting at 0 together. Print the total
Expert's answer
#include<iostream>

#include<conio.h>

using namespace std;




void main(void)

{

int n, value;

int sum = 0;

cout << "Enter N value: " << endl;

cin >> n;




for (int i = 0; i < n; i++){

cout << "Enter the " << i+1 << " value" << endl;

cin >> value;

sum += value;

}

cout << "The sum of " << n << " values is : " << sum <<
endl;

getch();

}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions