/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int X, N, a,b=0;
scanf("%d %d", &X, &N);
while(N<=0)
scanf("%d", &N);
for(a=1; a<=N; a++)
{
b+=X;
X++;
}
printf("%d\n",b);
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int X, N, a,b=0;
scanf("%d %d", &X, &N);
while(N<=0)
scanf("%d", &N);
for(a=1; a<=N; a++)
{
b+=X;
X++;
}
printf("%d\n",b);
return 0;
}
//Happy_Coding
No comments:
Post a Comment