[ create a new paste ] login | about

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

C, pasted on Aug 20:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
	int i, n;
	float S;
	do
	{
		printf("\nNhap n(n >= 2): ");
		scanf("%d", &n);

		if(n < 2)
		{
			printf("\nn phai >= 2. Xin nhap lai !");
		}
	}while(n < 2);
	i = 3;
	S = pow(2.0, 1.0/2);
	while(i <= n)
	{
		S = pow((i + S) * 1.0, 1.0/i);
		i++;
	}
	printf("\nTong la %f", 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 5
#include<bits/stdc++.h>

using namespace std;
int main(){
int n;
cout << "Enter your sentence: ";
cin >> n;
float S= static_cast<float>(0);
//float temp= static_cast<float>(1);

for( int i=0;i <=n;i++){
S= S+ pow(n-i*1.0,1.0/(n-i));
}
cout<<"Sum= "<<S<<
endl;
return 0;
}
reply
posted by yonnon on Jul 5
xong bài 37 :3 tiếp 38 hoi
reply