You are not logged in. Please login at www.codechef.com to post your questions!

×

Check and help whats wrong in this simple code

include<stdio.h>

int main() { int t,n1,n2,i,sum=0; scanf("%d",&t); for(i=0;i<t;i++) { sum=0; scanf("%d",&n1); scanf("%d",&n2); sum=n1+n2; printf("Sum =%d",sum); } return 0;

}

asked 08 Sep '17, 19:06

kilwidme9's gravatar image

0★kilwidme9
1
accept rate: 0%

Looks like you're asking for two numbers and printing their sum. Correct me if I'm wrong, I ran your code it works fine. What's the problem you having please provide some more information

(08 Sep '17, 19:15) kunnu1202★

I think there is some syntax error. Like you have missed a semicolon or something.

link

answered 08 Sep '17, 23:30

suhail_786's gravatar image

3★suhail_786
11
accept rate: 0%

There can two options where it can be wrong! 1)U forgot to include "#" before include<stdio.h>.

2)I think u need to output on new line for each test case.

Hope it helps :)

link

answered 09 Sep '17, 04:27

beginner_1111's gravatar image

4★beginner_1111
240110
accept rate: 13%

your code looks perfect whats the problem that u are facing?

link

answered 09 Sep '17, 23:43

phantomhive's gravatar image

4★phantomhive
944
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×200
×68

question asked: 08 Sep '17, 19:06

question was seen: 401 times

last updated: 09 Sep '17, 23:43