Once a positive range has been entered, we print the multiplication table. If the value of range is negative, the loop iterates again to ask the user to enter a positive number. Learning the Times Tables need not a tedious chore Learning them can be fun if you build up your knowledge gradually through. Here, we have used a do.while loop to prompt the user for a positive range. Printf("Enter the range (positive integer): ") Multiplication Table Up to a range #include The multiplication tables from 2 to 20 are used in everyday life. Here's a little modification of the above program to generate the multiplication table up to a range (where range is also a positive integer entered by the user). So the pattern is 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 (And once you remember those, you also know 3×2, 4×2, 5×2, etc., right) 5× has a pattern: 5, 10, 15, 20, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |