打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
076.计算高次方数的尾数
#include<stdio.h>
void main()
{
    int i,x,y,last=1;    /*变量last保存求X的Y次方过程中的部分乘积的后三位*/
    clrscr();
    puts("**********************************************************");
    puts("*  This is a program to calculate the last 3 digits of   *");
    puts("*              high order value, e.g., 13^15.            *");
    puts("**********************************************************");
    printf("\n >> Input X and Y(X^Y): ");
    scanf("%d%d",&x,&y);
    for(i=1;i<=y;i++)                /*X自乘Y次*/
        last=last*x%1000;     /*将last乘X后对1000取模,即求积的后三位*/
    printf("\n >> The last 3 digits of %d^%d is: %d\n",x,y,last%1000); /*打印结果*/
    puts("\n >> Press any key to quit...");
    getch();
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
“put”考题及答案(41--45)
围观世界上最不称职的父母
C语言中字符串的查找
. put on与 in用法
听到“what a shame”99%的人都以为是“真无耻”,然而真相是…
How to Improve Your Writing Skills (with Writing E...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服