Answer to Question #168218 in C++ for sara

Question #168218

. Write a program that prints all that counts from 1 to 100


1
Expert's answer
2021-03-03T08:02:42-0500
//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
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS