|
|
back to boardA+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 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 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 } |
|
|