-->
当前位置:首页 > 题库

PROGRAMMING:Odd sequence summation (*)

Luz5年前 (2021-05-10)题库413
**Here is the sequence of odd numbers:
$$1, 3, 5, 7, 9, ...$$
Please write a program to input the number of items of odd number sequence $$n $, and find the sum of the first $$n $$items of odd number sequence $$s $.
####Input format
> $$n$$
####Output format
> $$s$$
Note: the title guarantees that the values of $$n $$and $$s $$are in the range of long long int type.
####Input sample
```in
two
```
####Output sample
```out
four
```







answer:If there is no answer, please comment
This problem is solved directly by the formula of arithmetic sequence, without the use of circular statements.