system
November 22, 2018, 11:40am
1
Read two integer variables, calculate their sum, and print it.
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
1 Like
hjr265
September 16, 2019, 10:58am
3
Looks like you figured it out on your own.
1 Like
WHATS WRONG?
#include<stdio.h>
int main()
{
int A,B;
scanf("%d",&A);
scanf("%d",&B);
printf("%d",A+B);
return 0;
}
hjr265
September 16, 2019, 3:45pm
5
This code is okay.
I checked your latest submission. You are getting “Compilation Error”. Please check what you are being told in the submission page. There will be a brief explanation of why your code is failing to compile.
1 Like
It accepted the first case.but the 2nd case is not correct…hlp pls
#include<stdio.h>
int main()
{
int A,B,sum;
A=4;
B=5;
sum=A+B;
{printf("%d",sum);}
return 0;
}
hjr265
September 16, 2019, 4:16pm
7
The reason is explained in the submission page:
You need to read the values of A
and B
from input.
I am confused though. You were already doing it correctly in your previous code. Why did you change that?
asdfghj
September 20, 2019, 8:21am
8
#include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long ll2,ll1;
cin >> ll1;
cin >> ll2;
cout <<ll1+ll2 << endl;
return 0;
}
I got Wrong answer on 6th test case… help me out
hjr265
September 20, 2019, 10:36am
9
Why use unsigned long long
?
1 Like
I have solved a Problem but that is just running for 2 minutes.
what is wrong ?
hjr265
September 24, 2019, 7:05am
11
@Wasif_719 Can you please share the submission ID?
when I submit my coding…it shows that its running…but when I refresh the page… everytime I can only see complitation error…
what’s wrong??
hjr265
September 27, 2019, 5:14pm
13
It is because there are syntactical errors in your code. You need to make sure the code you have written is valid C code.
When you get Compilation Error, pay close attention to what is said in the submission page. It will tell you about the exact issues in your code.
hjr265
Split this topic
September 27, 2019, 5:34pm
14
A post was split to a new topic: Programming Help
amin83
September 28, 2019, 9:25am
15
I wrote this code and it is running in Python IDLE.
def add(a,b):
if a < 20000000 and b <20000000:
print(a+b)
else:
pass
a = int(input())
b = int(input())
add(a,b)
But it is showing runtime error. Why?
@amin2783
The numbers are in the same line not in separate lines.
try using,
a, b = map(int, input().split())
instead of
a = int(input())
b = int(input())
#include <stdio.h>
int main() {
int a,b;
scanf("%d,%d",&a,&b);
printf("%d",a+b);
return 0;
}
What is wrong?
hjr265
October 6, 2019, 8:22am
19
scanf("%d,%d",&a,&b);
^ This comma