Closed roberthsu2003 closed 3 months ago
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
int main(void) {
double num1 = 0;
double sum = 0;
printf("Please enter a value:");
scanf("%lf", &num1);
sum = num1;
num1 *= num1;
sum *= num1;
printf("The square value is %.2lf\n", num1);
printf("The cube value is %.2lf\n", sum);
return 0;
}
#include <stdio.h>
//請使用者輸入一個任意數,程式會顯示此數的平方值及立方值(請使用複合指定運算子*=)
int main(void) {
double m,n;
printf("請輸入一個數字:");
scanf("%lf",&n);
m=n;
m*=n;
printf("平方值=%lf\n",m);
m*=n;
printf("立方值=%lf\n",m);
return 0;
}
#include <stdio.h>
int main(void) {
double n, m;
printf("請輸入任意數:");
scanf("%lf", &n);
m = n;
printf("%.2lf的平方是:", m);
printf("%.2lf\n", n *= n);
printf("%.2lf的立方是:", m);
printf("%.2lf\n", m *= n);
return 0;
}
#include <stdio.h>
//請使用者輸入一個任意數,程式會顯示此數的平方值及立方值(請使用複合指定運算子*=)
int main(void) {
double s,c;
printf("請輸入一個任意數:");
scanf("%lf", &s);
c=s;
s*=s;
c*=s;
printf("%lf的平方是%lf\n", c/s, s);
printf("%lf的立方是%lf\n", c/s, c);
return 0;
}
#include <stdio.h>
//請使用者輸入一個任意數,程式會顯示此數的平方值及立方值(請使用複合指定運算子*=)
int main(void) {
int x,y;
printf("請輸入一個數字:\n");
scanf("%d",&y);
x = y;
x *= y;
printf("此數平方值=%d\n",x);
x *= y;
printf("此數立方值=%d\n",x);
return 0;
}
#include <stdio.h>
int main(void) {
int n, m;
printf("請輸入任意整數:");
scanf( "%d" , &n);
printf("%d的平方是%d\n", m = n, n *= n);
printf("%d的平方是%d\n", m, n *= m);
return 0;
}
#include <stdio.h>
int main(void) {
double a,b;
printf("請輸入一個任意數:");
scanf("%lf", &a);
b=a;
a*=a;
b*=a;
printf("%lf的平方是%lf\n", a, a);
printf("%lf的立方是%lf\n", a, b);
return 0;
}
int main(void) {
int n,m;
printf("請輸入任意數");
scanf("%d",&n);
m=n;
n*=n;
printf("%d平方為:%d\n",m,n);
n*=m;
printf("%d立方為:%d\n",m,n);
return 0;
`}```
int main(void) { double x , y;
printf("請輸入任意數:"); scanf("%lf",&x); y = x;
printf("該值得平方值為:%lf\n",x*= x);
printf("該值得立方值為:%lf\n",x*= y);
return main(); }
#include <stdio.h>
/*請使用者輸入一個任意數,程式會顯示此數的平方值及立方值(請使用複合指定運算子*=)*/
int main(void) {
int x,y,z;
printf("請輸入任意數:");
scanf("%d",&x);
y = x ;
y *=x ;
z = y;
z *=x;
printf("%d的平方是%d\n",x,y);
printf("%d的立方是%d\n",x,z);
return 0;
}