[ create a new paste ] login | about

Link: http://codepad.org/62tXx1st    [ raw code | output | fork | 2 comments ]

C, pasted on Sep 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<stdio.h>
#include<conio.h>

int main()
{
	float a, b;
	printf("\nNhap a: ");
	scanf("%f", &a);
	printf("\nNhap b: ");
	scanf("%f", &b);

	if(a * b > 0)
		printf("\n%10.3f va %10.3f cung dau", a, b);
	else
		printf("\n%10.3f va %10.3f khong cung dau", a, b);
	getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments:
posted by yonnon on Jul 12
#include<bits/stdc++.h>

using namespace std;
int main(){
float a;
float b;
cout <<"Enter a= ";
cin >> a;
cout << "Enter b= ";
cin >> b;
if(a<0 && b>0){
cout<<"Khong cung dau ";
return 0;
}
else if(a>0 && b>0 || a<0 && b<0 || a==0 && b==0){
cout << "Cung dau ";
return 0;
}
cin.ignore();
return 0;
}
reply
posted by lehoangan01 on Nov 3
#include <iostream>
using namespace std;

int main(){
double a, b;
cout << "pls input a and b " << endl;
cin >> a;
cin >> b;
if ( a*b > 0) {
cout << "a va b la hai so cung dau" << endl;
}
else if (a*b == 0){
cout << "a va b phai khac 0 " << endl;
}
else {
cout << "a va b trai dau" << endl;
}
return 0;
}
reply