Find the sum of all integers 1 through N that are divisible by 3 in C# – Programming, Pseudocode Example, C# Programming Example
Basic C# Console For Loop If Else Statement

Find the sum of all integers 1 through N that are divisible by 3 in C#

Find the  sum of all integer between 1 and N that are divisible by 3.

Variables are defined in the first row.  In the loop “if statement” checks the number is divisible by 3

In the last line we print the result of processing on the screen.

Code:

Output:

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.