adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

program in c to print pattern sum

program in c to print pattern sum


#include<stdio.h>
#include<conio.h>
  int main()
    {
     int i,j,sum=0;
     for(i=1;i<=5;i++)
      {
        for(sum=0,j=1;j<=i;j++)
           {
            sum+=j;
            if(j!=i)
              printf("%d + ",j);
            else
              printf("%d = ",j);
  }
            printf("%d",sum);
     printf("\n");
       }
      getch();
   }
Output:-

Post a Comment

0 Comments