#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
unsigned long sum;
int i;
char sn[20] = { "1-" }, temp3[2] = { "-" };
static char temp1[10], temp2[10], name[20];
again: puts("Please Input Your Name:\n");
gets(name);
if (!strchr(name, '@'))
{
puts("Name Must Include '@'!");
goto again;
}
for (i = 0, sum = 0; i < strlen(name); i++) sum += name[i];
ulltoa(276682 - sum, temp1, 10);
strcat(sn, temp1);
sum = 0; i = 0;
while (sn[i])
{
sum += sn[i];
i++;
}
ulltoa(sum, temp2, 10);
strcat(sn, temp3);
strcat(sn, temp2);
printf("Your RegCode Is:%s", sn);
}