#explanation

9 messages · Page 1 of 1 (latest)

timber plover
#
#include <iostream>
using namespace std;
int main()
{

int n,t;
cin>>t;
for(int i=0;i<t;i++)
{  
int a,b,c;
cin>>a>>b>>c;
 c=a*b;
if(c%4==0)
{
  cout<<(c/4)<<endl; 
}
else 
{
cout<<((c=c/4)+1)<<endl ;
}
}
}
``` the problem in this code is when i edited cin>>c above it gave me my desired output , i wanna know what was the problem internally in it
white stormBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.

spice warren
#

Why ask the user to enter c when on the next line its value is overwritten with a*b?

#

How about posting examples of input and expected output?

timber plover
spice warren
#

Your input/output is difficult to understand.
Mind putting it between ```?

4
2,1,5
expected: 1
observed: 3
2,6,3
expected: 3
observed: 4
3,4,5
expected: 3
observed: 5
4,5,7
etc.
jolly lanceBOT
#
How to Format Code on Discord

• type three "backticks" (not quotes/apostrophes, on QWERTY layout, left of 1-key)
• on the same line, type the file extension for that language (c or cpp)
• enter your code on a new line and put another three backticks at the end

Example Input

```cpp
int main() {
    return 0;
}
```

Example Output
int main() {
    return 0;
} ```
spice warren
#

(with no file extension - that part is optional anyway)

white stormBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.