IGNOU, SMU and KSOU Bsc solved assignments – C++ Program to find the sum and square of numbers between 1 to ‘n’.

IGNOU, SMU and KSOU Bsc solved assignments – C++ Program to find the sum and square of numbers between 1 to ‘n’.

If you are BSc IT, Btech C/S, MCA or Msc computer science or Bsc computer science students and looking for solved assignments on C++ here is proper solution.

Below Program to find the sum and square of numbers between 1 to ‘n’. It is solved assignment for IGNOU, SMU and KSOU Bsc IT or Computer science students and MCA students.

 

// Program to find the sum and square of numbers between 1 to ‘n’.

 

#include<iostream.h>

#include<conio.h>

 

void main()

{

clrscr();

 

int n,sum=0,sq;

 

cout<<” Enter a value for N : “;

cin>>n;

 

cout<<” Index ” <<”\t    “<<” Squares “;

 

for(int i=1;i<=n;i++)

{

sq=i*i;

cout<<”\n “<<i<<”\t\t”<<sq;

 

sum=sum+sq;

}

 

cout<<”\n\n Sum of Square’s is : “<<sum;

 

getch();

}

All New Updates

Leave a Reply

Your email address will not be published. Required fields are marked *

Security Code: