Skip to content

Commit cdcf040

Browse files
authored
Add files via upload
1 parent 72a5251 commit cdcf040

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.util.Scanner;
2+
public class Question1 {
3+
public static void main(String[] args) {
4+
5+
6+
7+
Scanner s = new Scanner(System.in);
8+
int n = s.nextInt();
9+
10+
int x = 1;
11+
int sum = 0;
12+
for (int i = 0; i < n; i++)
13+
{
14+
sum += x;
15+
x += 2;
16+
17+
}
18+
System.out.print(sum);
19+
}}

0 commit comments

Comments
 (0)