. Write a program that prints all that counts from 1 to 100
//double slashes are used for single line comments
#include <stdio.h> //#include is a preprocessor that include header files from C library
//stdio.h is Standard Input/output header file that contains functions like printf()
int main() //Execution starts at main()
{
//Return type of main in integer.
int i; //i is used to count from 1 to 100
for(i = 1; i <= 100; i++) //for loop is used to loop for fixed number of times.
{
if (i >= 32 && i <= 39) //Checking if i is between 32 and 39
printf("%d\n", i); //printf() is used to print to the console.
//%d is format string which will be replaced by integer variable provided after ,
//\n is for new line. The string to be printed is provided in "".
}
return 0; //Returning integer
}
Comments
Leave a comment