|
|
back to boardwhats wrong!!!!! Everything is right #include<stdio.h> main() { int n, a, b; int weight; while (scanf("%d", n) != EOF || scanf("%d", a) != EOF || scanf("%d",b) != EOF) { weight = n*a*b * 2; printf("%d", weight); } return 0; } Re: whats wrong!!!!! Everything is right 1. You should specify the return type value for the main function: int main() {} 2. Is not necessarry to read the input data until the end of stream. Just read it one time: int n, a, b, w; scanf("%d%d%d", &n, &a, &b); w = n*a*b*2; printf("%d\n", w); Re: whats wrong!!!!! Everything is right Please read scanf documentation. It returns count of read variables. Also - task description means 3 and only 3 integers to read. Why did you use "while" here? Re: whats wrong!!!!! Everything is right The main problem is in "||". You should use "&&" anyway. Otherwise, the shortpath magic happens. |
|
|