Computer Science, asked by aryanroy63, 3 months ago

write a program in c++ to find the sum and product of the first five natural numbers​

Answers

Answered by Anonymous
11

Required C++ program:

/* Program to find the sum and product

of first five natural numbers. */

#include <iostream.h>

#include <conio.h>

void main()

{

clrscr();

int sum, product;

sum = 1+2+3+4+5

product = 1*2*3*4*5

cout <<"Sum of the first five natural numbers is "<<sum;

cout <<"\nProduct of the first five natural numbers is "<<product;

getch();

}

Output:

The output will be as follows:

Sum of the first five natural numbers is 15

Product of the first five natural numbers is 120

Similar questions