Write a program to calculate the following
i want a c++program for this condition
1+4+9+16+….+100
Like this (1^2+2^2)
Hint use function pow(a,b)
Answer Posted / yogeshwaran
#include<iostream>
using namespace std;
#include<math.h>
main()
{
double j=0,l=0;
double k=0;
int max=0;
cout<<"enter a maximum value"<<endl;
cin>>max;
for(int i=1;l<=max;i++)
{
j=pow(i,2);
l=j;
j=j+k;
k=j;
}
cout<<"value is "<<j<<endl;
}
Is This Answer Correct ? | 42 Yes | 5 No |
Post New Answer View All Answers
There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.
Is rust better than c++?
What is a try block?
Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Difference between a homogeneous and a heterogeneous container
What is the use of seekg in c++?
What is #include iomanip?
Refer to a name of class or function that is defined within a namespace?
What is the limitation of cin while taking input for character array?
What is a string example?
Is c++ pass by reference or value?
Do the parentheses after the type name make a difference with new?
Why is c++ difficult?
What is the difference between interpreters and compilers?
Why Pointers are not used in C++?