[ create a new paste ] login | about

Link: http://codepad.org/1BoZOolV    [ raw code | output | fork | 1 comment ]

C, pasted on Sep 6:
#include<stdio.h>
#include<conio.h>

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

	printf("\nNhap b: ");
	scanf("%f", &b);

	printf("\nNhap c: ");
	scanf("%f", &c);
 
	if(a < 0)
	 a = -a;
	if(b < 0)
	 b = -b;
	if(c < 0)
	 c = -c;

	 printf("\na = %f", a);
	 printf("\nb = %f", b);
	 printf("\nc = %f", c);

	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(){
int n;
cout <<"Enter your sentence: ";
cin >> n;
int arr[n-1];
for(int i=0; i<n; ++i){
cout <<"A["<<i+1<<"]= ";
cin >> arr[i];
}
for(int i=0; i<n; ++i){
if(arr[i] < 0){
arr[i] = abs(arr[i]);
}
}
cout<<"Value: ";
for(int i=0; i<n ; ++i){
cout<<" "<<arr[i];
}
return 0;
}
reply