Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Specifer



Iterative statement



Header file



Working with switch case



Test expression




// AHF C PROGRAM SOLVING

//solving here ITERATIVES STATEMENTS type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int i,a,res=0,temp; //taking the number to continue loop pf("Enter any number: "); scanf("%d",&a); for(i=1;i<=a;i++) { temp=pow(i,2); //calculating as given in the series and assigning temp res+=temp; //value of the temp is adding with res variable } pf("\nThe summation of the series is: %d",res); return 0; }
OUTPUT:


© 2018 - All rights reserved