write a c program to add first 10 successive integer

/*write a c program to add first 10 successive integer*/

#include<stdio.h>
#include<conio.h>

void main()

{
 int x,n,i,ans=1;
 clrscr();
 printf("enter value of x:");
 scanf("%d",&x);
 printf("enter value of n:");
 scanf("%d",&n);
 for(i=1;i<=n;i++)
 {
  ans=ans+x;
 }
 printf("ans:%d",ans);
 getch();
}

No comments:

Post a Comment