[C] blue language Bridge Cup training algorithm to calculate the square

] [Problem Description
input a positive integer, m, the output of a 2% m, which represents the power, i.e., a ^ 2 denotes a square, and% indicates modulo.

[Input format
input contains two integers a, m, a not more than 10000.
  
[] Output format
output an integer, i.e., a ^ 2% m values.
  
[Sample input]
56

[Output] Sample
1

#include<stdio.h>
int main(int argc,char argv[])
{
	int a,m;
	scanf("%d%d",&a,&m);
	printf("%d\n",a*a%m);
	return 0;
}
Published 18 original articles · won praise 1 · views 1112

Guess you like

Origin blog.csdn.net/qq_41666142/article/details/104776192