Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Test expression



Working with switch case



Iterative statement



Specifer



Header file




Summation of first N natural number



// AHF C PROGRAM SOLVING

//solving here ITERATIVES STATEMENTS type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int n,j,sum=0; //taking the number to continue loop pf("Enter any integer number: "); scanf("%d",&n); for(j=0;j<=n;j++) sum+=j; pf("\nThe summation of first %d natural number is : %d",n,sum); return 0; }
OUTPUT:


© 2018 - All rights reserved