December 31, 2010

c語言程式 二次 三次 四次方的計算


#include
#include
 
 int main(void)
{
     int x,a,b,c;
     int square(int);
     int cube(int);
     int power4(int);
     printf("input x=");
     scanf("%d",&x);
     
     a=square(x);
     b=cube(x);
     c=power4(x);
     
     printf("the square of %d=%d\n",x,a);
     printf("the cube of %d=%d\n",x,b);
     printf("the power4 of %d=%d\n",x,c);
     system ("pause");
     return 0;
}
     int square(int n)

{
     return n*n;
}
     int cube(int n)
{
     return n*n*n;
}
    int power4(int n)
{
    return n*n*n*n;
}         

0推薦此文章
Today's Visitors: 0 Total Visitors: 37
Personal Category: c語言程式 Topic: learning / education / linguistic
Previous in This Category: c語言程式 圓的周長,體積,表面積 和 圓柱,圓錐的體積,表面積   Next in This Category: c程式語言 停車場費率
[Trackback URL]

Reply
Post A Comment









Yes No



Please input the magic number:

( Prevent the annoy garbage messages )
( What if you cannot see the numbers? )
Please input the magic number

誰來收藏
Loading ...
unlog_NVPO 0