+ 1

Write a program to print the sum of first thirty odd numbers?

11th Oct 2017, 11:56 AM
JRM ASIF
JRM ASIF - avatar
3 Respuestas
+ 1
In Python print(30*30)
11th Oct 2017, 1:00 PM
Kartikey Sahu
Kartikey Sahu - avatar
0
int result = 0; for(int i = 1; i < 60; i+=2) {result += i;} std::cout << result;
11th Oct 2017, 12:16 PM
Shadow
Shadow - avatar
0
print((59+1)*15) it is Gauss 1 + 59 + 3 + 57 + .... in general print((i_th odd +1) *(i_th odd + 1) /2)
11th Oct 2017, 12:27 PM
Oma Falk
Oma Falk - avatar