Question: What's wrong with the program although when n=3 the output is correct but when n=10 the output is negative topltask3-04.cpp -Dev-C++ 5.11 iew Project Execute

 What's wrong with the program although when n=3 the output is
correct but when n=10 the output is negative topltask3-04.cpp -Dev-C++ 5.11 iew
What's wrong with the program although when n=3 the output is correct but when n=10 the output is negative

topltask3-04.cpp -Dev-C++ 5.11 iew Project Execute Tools AStyle Window Help bals) task1-04.cpptask2-04.cppl task3-04.cpp|www.cpp 1 #include 2 int 3 main (void) ug int n,k,i-1j double sum-e printf("Enter n "); scanf ("Xd",8n) if (nk-e I n> 15) printf("ERROR) else 5 6 9 10 12 13 14 for (k-likc= nsk++) 15 16 17 18 19 20 21 sum sum 2*(i)sl i = i*10 + 1; 23 24 F 25 26 27 28 29 F 30 printf("the sun is %.elf" , sun); Write a program to compute the sum of the following series with n terms. Sum- 2 + 22+222+2222+... The program reads the values n from the user. If n or n> 15, it displays an appropriat and terminates. Otherwise, it computes and displays the sum. Note: make your sum and your terms of type double but print the sum without digits after de Enter n:1 is out of range Enter n3 sum of series for 3 terms is 246 Enter n:10 sum of series for 10 terms is 2469135800

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!