Statement inside a statement.
Following the tutorial at this site. I now have to write a program that counts from 1 to 10 and displays a "special" output when it reaches the numbers 3 and 10.
I came up with the following but I am wondering if there is any other way to do this that is more easy using conditional statements.
Code:
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int counter;
for(counter = 0; counter < 11; counter++)
{
printf("The value of the counter is now %d.\n", counter);
if(counter == 3)
printf("Hey damned, you made it to a value of 3.\n");
if(counter == 10)
printf("You are at the end now.\n");
}
system("PAUSE");
return 0;
}