ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1000. A+B Problem

A+B
Posted by Afina 10 Oct 2008 23:03
I don't understand why I get wrong answer:
#include <stdio.h>
#include <stdlib.h>

main()
{
  float a,b;
  printf("Enter a:");
  scanf("%f",&a);
  printf("Enter b:");
  scanf("%f",&b);
  printf("a+b=%3.2f",a+b);
  system("PAUSE");
  return 0;
}

Edited by author 10.10.2008 23:04
Re: A+B
Posted by Vladimir Yakovlev (USU) 10 Oct 2008 23:59
Your program outputs this instead of just "6" for sample:

Vvedite a:Vvedite b:a+b=6.00

See examples of correct solutions in the FAQ
Re: A+B
Posted by Brisan Alex 21 Feb 2009 11:38
This problem is solved to complicate.In C++ the correct answer is:
#include<iostream.h>
long a,b;
int main()
{
cin>>a>>b;
cout<<a+b;
return 0
}