This is a Dart program that demonstrates the use of a for 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.
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 for loop that executes the code inside the loop for a specified number of times, in this case, from 1 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 for loop in Dart to perform a set of instructions a specific number of times. In this case, the program prints the multiplication table for a given number t up to a given limit n.
import 'dart:io'; void main() { var i,t,n; print('Enter the Table and Limit : '); t=int.parse(stdin.readLineSync()); n=int.parse(stdin.readLineSync()); for(i=1;i<=n;i++) { print(t.toString()+'*'+i.toString()+'='+(i*t).toString()); } }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