Posts

Write a Dart program to that takes three numbers(x,y,z) as input and print the output of (x+y).z and x.y + y.z.

Image
Code: import   'dart:io' ; void   main () {    print ( 'Input first number : ' );    int  x =  int . parse (stdin. readLineSync ());    print ( 'Input second number : ' );    int  y =  int . parse (stdin. readLineSync ());    print ( 'Input third number : ' );    int  z =  int . parse (stdin. readLineSync ());    print ( '(x+y)*z = ${ (x + y) * z }' );    print ( 'x*y + y*z = ${ (x * y) + (y * z) }' ); } Output:

Write a Dart program that takes four numbers as input to calculate and print the average

Image
Code: import   'dart:io' ; void   main () {    print ( 'Input first number : ' );    int  a =  int . parse (stdin. readLineSync ());    print ( 'Input second number : ' );    int  b =  int . parse (stdin. readLineSync ());    print ( 'Input third number : ' );    int  c =  int . parse (stdin. readLineSync ());    print ( 'Input fourth number : ' );    int  d =  int . parse (stdin. readLineSync ());    print ( 'Average of $ a ,$ b ,$ c ,$ d  = ${ ((a + b + c + d) / 4).round() }' ); } Output:

Write a dart program that takes a number as input and print its multiplication table.

Image
Code: import   'dart:io' ; void   main () {    print ( 'Input  Number : ' );    int  a =  int . parse (stdin. readLineSync ());    for  ( int  i =  1 ; i <=  10 ; i++) {      print ( '$ a  x $ i  = ${ a * i }' );   } } Output:

Write a Dart program to print on screen the output of adding, subtracting, multiplying and dividing of two numbers which will be entered by the user.

Image
Code: import   'dart:io' ; void   main () {    print ( 'Input first Number : ' );    int  a =  int . parse (stdin. readLineSync ());    print ( 'Input Second Number : ' );    int  b =  int . parse (stdin. readLineSync ());    int  result = a + b;    print ( '$ a  + $ b  : $ result ' );   result = a - b;    print ( '$ a  - $ b  : $ result ' );   result = a * b;    print ( '$ a  x $ b  : $ result ' );   result = (a / b). round ();    print ( '$ a  / $ b  : $ result ' ); } Output:

Write a dart program to print the output of multiplication of three numbers which will be entered by the user

Image
Code: import   'dart:io' ; void   main () {    print ( 'Input first Number : ' );    int  a =  int . parse (stdin. readLineSync ());    print ( 'Input Second Number : ' );    int  b =  int . parse (stdin. readLineSync ());    print ( 'Input Third Number : ' );    int  c =  int . parse (stdin. readLineSync ());    int  result = a * b * c;    print ( 'Multiplication of three numbers : $ result ' ); } Output:

Write a Dart program to swap two numbers.

Image
Code: void   main () {    var  a =  7 ;    var  b =  10 ;    print ( 'a= $ a ' );    print ( 'b= $ b ' );    var  temp = a;   a = b;   b = temp;    print ( 'a= $ a ' );    print ( 'b= $ b ' ); } Output:

Write a dart program to print the result of the specified operations.

Image
Test data: -1 + 4 * 6 ( 35+ 5 ) % 7 14 + -4 * 6 / 11 2 + 15 / 6 * 1 - 7 % 2 Expected Output : 23 5 12 3 Code: void   main () {    print (- 1  +  4  *  6 );    print (( 35  +  5 ) %  7 );    print ( 14  + - 4  *  6  /  11. round ());    print ( 2  +  15  /  6  *  1  -  7  %  2 ); } Output:

Write a dart program to print the result of dividing two numbers

Image
code: void   main () {    int  a =  10 ;    int  b =  15 ;    print (a / b); } Output:

Write a Dart program to print the sum of two numbers

Image
Code: void   main () {    int  a =  10 ;    int  b =  15 ;    print (a + b); } Output:

Write a Dart program to print Hello and your name in a separate line

Image
Code: void   main () {    print ( 'hello' );    print ( 'Yogesh' ); } Output: