Search found 2 matches

by kevin3377
3 years ago
Forum: Problem set
Topic: 1049 - Sum
Replies: 16
Views: 8340
Gender: None specified

Re: 1049 - Sum

He consultado con unos amigos y hasta con un profesor y no encontramos el error. Estará mal la revisión al ser juzgado? Gracias!
by kevin3377
3 years ago
Forum: Problem set
Topic: 1049 - Sum
Replies: 16
Views: 8340
Gender: None specified

Re: 1049 - Sum

Been trying to get this C++ code accepted:

#include <iostream>

using namespace std;

int main(){
int number;
int sum = 0;
cin >> number;
sum = (abs(number)*(abs(number)+1))/2;
cout << sum;

return 0;
}

Wrong Answer everytime. Any clues? Thanks!

Go to advanced search