U E D R , A S I H C RSS

이태균/LittleAOI/주민등록번호확인하기

소 감



코 드

package main

import (
	"fmt"

)

func main(){

	var ssn2 string
	var remainder int
	sumtemp := 0
	fmt.Scanf("%s",&ssn2)
	ssn :=[]rune(ssn2)

	for i:=0;i<8;i++{
		sumtemp += (int(ssn[i])- '0')*(i+2)

	}
	for i:=8;i<12;i++{
		sumtemp += (int(ssn[i])- '0')*(i-6)
	}
	remainder = sumtemp%11
	remainder = 11-remainder
	if remainder==10 {
		remainder = 0
	}
	if remainder == (int(ssn[12])- '0') {
		fmt.Println("대한민국 국민이네요~ ^^ 안녕하세요")
	}else {
		fmt.Println("혹시 간첩???? -_-;; ")
	}
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-16 14:07:56
Processing time 0.0139 sec