It's a bit trickier than it looks because a number can be a multiple
of both 3 and 5, and it's not specified what the program should do.
However most probably the user wants a "TF".
Pardon my late posting, but I just ran across something (elsethread)
that relates: this "challenge" looks a lot like the "FizzBuzz" test
(
http://c2.com/cgi/wiki?FizzBuzzTest).
If it is, then one solution might be:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned int count;
for (count = 1; count <= 100; ++count)
{
char number[4];
sprintf(number,"%u",count);
printf("%s%s\n",(count%3&&count%5)?number
count%3?"":"T"),count
%5?"":"F");
}
return EXIT_SUCCESS;
}
Or, less obfuscated:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned int count;
for (count = 1; count <= 100; ++count)
if (count%3 && count%5)
printf("%u\n",count);
else
printf("%s%s\n",count%3?"":"T",count%5?"":"F");
return EXIT_SUCCESS;
}