日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

08、求x的y的幂次方的最后3位数——循环

發(fā)布時間:2025/5/22 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 08、求x的y的幂次方的最后3位数——循环 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

求x的y的冪次方的最后3位數(shù)

求x的y的冪次方的最后3位數(shù)

程序代碼如下:

  /*2017年3月12日14:07:05功能:程序求x的y的冪次方的最后3位數(shù)*/#include"stdio.h"void fun(int);int main(){int x, y;int x_power_y = 1;printf("please int two number x and y :");scanf("%d %d", &x, &y);for (int i = 0; i < y; i++){x_power_y *= x;}if (x_power_y < 999){printf("the last three number of the x power y is %d ", x_power_y);}else{fun(x_power_y); //大于999,進(jìn)入調(diào)用函數(shù)}}void fun(int x_power_y){int first = x_power_y % 10; //此時求得是最后一位上的數(shù)值int second = (x_power_y % 100 - first * 1) / 10; //x_power_y % 100是最后兩位上的數(shù)值int thrid = (x_power_y % 1000 - second * 10 - first * 1) / 100;printf("the last three number of the x power y is %d \n", thrid*100+second*10+first);}/*總結(jié);在VC++6.0中顯示的結(jié)果:——————————————————please int two number x and y :11 3the last three number of the x power y is 331——————————————————*/

  

轉(zhuǎn)載于:https://www.cnblogs.com/wxt19941024/p/6537808.html

總結(jié)

以上是生活随笔為你收集整理的08、求x的y的幂次方的最后3位数——循环的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。