Question
using C++ and visual studio if possible.
011: calculate the formula 9 y = n kan
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the solution to above formula in C++. PLEASE GIVE A THUMBS UP!!

Read the code comments for more information

y = \sum_{k=0}^{9}n

C++ Code

#include<iostream>
using namespace std;


//function receives the integer argument n
//it returns the answer of summation
double function(double n)
{
   //variable used to sum the values
   int sum=0;
   //run a loop which is equivalent to Summation in mathematics
   //from k=0 till k<=9
   for(int k=0;k<=9;++k)
   {
       //add value of n in sum
       sum+=n;
   }
   //return the final answer
   return sum;
}


int main()
{
   //create a variable n to take user input of N
   double n;
   //print message and take user input
   cout<<"ENTER THE VALUE OF N: ";
   cin>>n;
   //display the calculated summation value
   cout<<"VALUE OF Y IS: "<<function(n)<<endl;
   return 0;
}


SCREENSHOT OF OUTPUT

1594481825880_image.png

Add a comment
Know the answer?
Add Answer to:
using C++ and visual studio if possible. 011: calculate the formula 9 y = n kan
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT