Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

" ; " after loop



Header file



Test expression



Working with switch case



Specifer




Calculate Summation of this series 1 + 22/2 + 32/3 + ...... + x2/x



// 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)/i; //calculating as given in the series and assigning temp res+=temp; //value of the temp is adding with res variable } //printing total value pf("\nThe summation of the series is: %d",res); return 0; }
OUTPUT:


© 2018 - All rights reserved