If the condition is not satisfied, it moves to the next step which is the else statement where print function will print the values of num which is obtained after the iteration of the loop with the given range.Following that we open another a for loop where the range for the variable i is (2,num) followed by a : after which we declare an if statement with condition (num % i) = 0 followed by a :, if the condition is satisfied, the break statement terminates the current loop. We declare a print function which displays the statement ("\nPrime numbers between", first, "and", last, "are:") after which we open a for loop where the range for the variable num is (first, last 1) followed by a.In the STDIN section of the code editor the input values are entered.Here we give the user the option to enter the values and the input values are scanned using the input function and are stored in the variable first and last with the statements/strings ("Enter the first integer: ") and ("\nEnter the last integer: "), we use the int function and declare the input value as an integer value.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |