PTA(Advanced Level) 1027:Colors in Mars(C语言实现)

PTA(Advanced Level) 1027:Colors in Mars(C语言实现)

#include 

void toMars(int n)
{
	char s,g;
	s=(n/13<10)?n/13+'0':n/13-10+'A';
	g=(n%13<10)?n%13+'0':n%13-10+'A';
	printf("%c%c",s,g);
}

int main()
{
	int r,g,b;
	scanf("%d%d%d",&r,&g,&b);
	putchar('#');
	toMars(r);
	toMars(g);
	toMars(b);
	return 0;
}

你可能感兴趣的:(PTA(advanced,level))