[英]How to write a code in C so as to get last two digits of any 5^n , where n is an integer. Here, n is input is taken by user
我想在 C 中编写代码以获得任何 5^n 的最后两位数字,其中 n 是 integer。 这里,n 是用户输入的。 请告诉此代码中的错误以下是我编写的代码
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
double n;
printf("Type Your Test Case");
scanf("%lf", &n);
double a = pow(5,n);
double last_two_dig= a%100;
printf("The last digits of the 5^n %lf", &last_two_dig );
return 0;
}
我想在 C 中编写代码以获得任何 5^n 的最后两位数字,其中 n 是 integer。 这里,n 是用户输入的。 请告诉此代码中的错误以下是我编写的代码
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
double n;
printf("Type Your Test Case");
scanf("%lf", &n);
double a = pow(5,n);
double last_two_dig= a%100;
printf("The last digits of the 5^n %lf", &last_two_dig );
return 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.