
HSC ICT Subject has a chapter called Programming Language. Today we will talk about a programming programming language. Today’s program is the topic of discussion “2² + 4² + 6² +… + n² C-program for determining the sum of This series” So, Let’s start..
2² + 4² + 6² +… + n² C-program for determining the sum of This series
Equipment required:
A personal computer. However, now the program can be run using the mobile app.
Required software:
Any one compiler program. E.g .: Turbo C ++
Presenting results:
Follow the procedure:
- Click on Start.
- Click on Programs / All programs.
- Click on Turbo C ++ 4.5.
- Click on Turbo C ++.
Start >> Programs / All programs >> Turbo C ++ 4.5 >> Turbo C ++
- Then we will see the editor window of Turbo C ++.
Program Code:
[#include <stdio.h>
#include <conio.h>int main ()
{
int i, n, sum=0;
printf(“Enter the value of n=”);
scanf(“%d”,&n);
for(i=2;i<=n;i=i+2)
sum=sum+(i*i);
printf(“Summation is:%d”,sum);
getch ();
}]
Save program:
- Click on File menu and click on Save / Save As. Then the Save As dialog box appears.
- Let’s type any name in the Text box of File Name.
- Select C ++ Source (* .c; *. Cpp) from the drop down list of List Files of Type.
- Let’s select Drive from Drives.
- Finally click on OK.
Run the program:
To run the program, click on Run from the Debug menu or press Ctrl + F9 key.
Result: If we enter the required value by entering the program code correctly, we will get the correct result.