[ create a new paste ] login | about

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

C, pasted on Sep 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
	double S;
   float x, n;

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

	printf("\nNhap n: ");
	scanf("%f", &n);
	n = 1/ n;
	S = pow(x, n);

	printf("Can bac %.2f cua %.2f la %.2f",1/n, x, S);

	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 17
#include<bits/stdc++.h>

using namespace std;
int main()
{
float S;
int n;
int x;
cout << "Enter x: ";
cin >> x;
cout << "Enter n: ";
cin >> n;

S = pow(x, static_cast<float>(1)/(n));
cout <<"Sum= "<<S<<
endl;
cin.ignore();
return 0;
}
reply