Table of Contents
What is a continue statement in C?
Continue is also a loop control statement just like the break statement. The continue statement is opposite to that of a break statement.
Continue Statement in C Programming In real life, we have a scenario where we need to execute the loops from the start. The C Programming has a “Continue” Feature. Let’s see how to use that. The continue statement is used to re-execute the loop from the start. It’s like we initialized the loop again.
It’s gonna be super fun to learn the continued feature of C Programming. This blog demonstrates Decrements in a loop in C Programming. To learn more about C Programming and its history, please read this blog first, “C Programming Complete Guide“.
Multiplication Table Using Continue Statement in C
We can print any multiplication table using Continue Statement For Loop in C Program. Well, let’s write the program for this.
Declaring Variables in C Program
Here, we will declare 3 variables i, input, and result. We will declare one more variable, “response,” as a character like this. We have printf statements, followed by the scanf statement to accept user input. To make it more friendly, we will add a few statements using printf. Now your program will be more user-friendly to understand the user.
Program Logic to continue statement in For Loop in C Program.
Then we will write FOR loop. Inside FOR loop, we will calculate the multiplication. Print using printf statement to display the result.
main() { int i, input, result; char response; printf("Execute Multiplication program\n"); printf("Enter number : "); scanf("%d", &input); for(i=1; i<=10;i++) { result = input * i; printf("%d * %d = %d\n",input,i,result); } }
We will display the print with the value of i , input and then result, just like we used to write in our home workbooks. Just execute it.
Output:
How to view all topics on C Programming
Watch full programming series on Amazon Prime free with Amazon Prime Membership.
- Amazon Prime link for the USA: https://www.amazon.com/dp/B07WFYJW6G
- Amazon Prime link for the UK: https://www.amazon.co.uk/dp/B07WFYQZ1G
- For Other Countries: To watch C Programming Content in another country, please visit the URL: https://newtum.com/course-details/c-programming-online.