Answer to Question #300223 in C++ for king

Question #300223

Write a program in C programming language that print the following sum of series 1+4+7+10………+N


1
Expert's answer
2022-02-20T10:00:01-0500




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




int main(){
	int sum=0;
	int n,i;
	printf("Enter n: ");
	scanf("%d",&n);


	for(i=1;i<=n;i+=3){
		sum+=i;
	}
	printf("Sum: %d\n\n",sum);






	scanf("%f",&i);
	return 0;
}





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog