Sunday, May 8, 2016

Find and Sum of First 10 Even Number



Write a C Code That Find and Sum First 10 Even Number.


#include<stdio.h>

int main()
{   int i,n,num=0,sum=0;
 printf("First 10 even number is:\n");
 for (i=1;i<=10;i++)
 {       num+=2;
  printf("%5d",num);
  sum +=num;
 }
 printf("\n\nThe sum of = %d\n",sum);
return 0 ;
}


Share this

0 Comment to "Find and Sum of First 10 Even Number"

Post a Comment