This is a Dart program that demonstrates the use of a do-while loop. The program starts by importing the dart:io library, which provides classes for reading input from the console. The next lines declare three variables i, t, and n and initialize i to the value 1.
The program then prompts the user to enter a table and a limit by printing the message 'Enter the Table and Limit : '. The user's input for the table and limit is read using the stdin.readLineSync() method and converted to integers using the int.parse() function.
The program then starts a do-while loop that executes the code inside the loop at least once and continues to do so as long as i is less than or equal to n. Inside the loop, the program prints the current value of t, i, and the result of t * i on the console using the print() function. This calculates and prints the multiplication table of t from 1 to n.
After printing the table for the current value of i, the program increments i by 1 using the expression i++. Once i is greater than n, the loop will terminate, and the program will exit.
Overall, this program demonstrates how to use a do-while loop in Dart to perform a set of instructions repeatedly and at least once as long as a certain condition is true. In this case, the program prints the multiplication table for a given number t up to a given limit n.
//Do While loop /* * Limit 5 * Table 2 2*1=2 2*5=10 */ import 'dart:io'; void main() { var i=1,t,n; print('Enter the Table and Limit : '); t=int.parse(stdin.readLineSync()); n=int.parse(stdin.readLineSync()); do { print(t.toString()+'*'+i.toString()+'='+(i*t).toString()); i++; }while(i<=n); }To download raw file Click Here
Enter the Table and Limit : 10 5 10*1=10 10*2=20 10*3=30 10*4=40 10*5=50
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions