View Code of Problem 3696

#include <stdio.h>
int main(){
  int n;
  int sum;
  int result;
  int i;
  while (scanf("%d",&n)!=EOF){
    sum=1;
	if(n==0){
		printf("1\n");
	}
	else{
    for(i=0;i<n;i++){
      sum*=n;
    }
    result = sum%10;
    printf("%d\n",result);
	}
  }
  
  
  
  return 0;
}

Double click to view unformatted code.


Back to problem 3696