游客 Signup | Login
中文 | En

3086 - 【设计型】第9章: 指针 9.13 简单地数学

输入一个正整数(范围[1..10000]),打印其平方(不保留小数位)、平方根、倒数。(用指针实现,保留2位小数,输出每个数之间以一个空格隔开)

Input

一个正整数。

Output

三个数,一个整数,两个保留两位小数

Examples

Input

2

Output

4 1.41 0.50

Solution C

#include<stdio.h>
#include<math.h>
void fun(int x,int *a,float *b,float *c);
int main()
{
	int x,a;
	float b,c;
	scanf("%d",&x);
	fun(x,&a,&b,&c);
	printf("%d %.2f %.2f",a,b,c);
	return 0;
}

void fun(int x,int *a,float *b,float *c)
{
	*a = x*x;
	*b = sqrt(x);
	*c = 1.0/x;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题