So, yesterday you kndly helped me breaking a loop but I realized I still don't understand how it works. I have as an example a very easy exercise. Using "for" I should print the table of the 10 first products of a number inserted by keyboard but this number must be between 1 and 10. This is my code:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
usingnamespace std;
int main()
{
cout << "Basics For Exercise 3" << endl;
int num;
printf("Table of products of numbers between 1 and 10 \n");
printf("Insert a number between 1 and 10: ");
scanf("%d", &num);
for (int i=1; i<=10; i++) {
printf("%d x %d = %d \n",num,i,num*i);
}
return 0;
}
what I want to do is break the loop when user insert a number <1 and >10. How can I do that?