Posts

Showing posts from May, 2021

ATM problem for beginner in dart | Programming in dart | Dart tutorial

Question Suman want to withdraw x  $US from an ATM . the case machine will only accept the transaction if x is multiple of 5 and also x is less or equal to the balance including the service charge of 0.50 $US which is to be applied only after a successful transaction. Calculate Suman account balance after the transaction.

To count Word in dart language | dart Programming | dart language | dart tutorial | word counter

Dart as language is way similar to c or c++. but there are certain function which are inbuilt in dart which is not in Either of the language.  So what we are having is a paragraph and we wanted to find number of unique word as well as number of word in paragraph.  so we will start with making an input to take paragraph from user.  import 'dart:io' ; main () { String ? text = stdin. readLineSync (); } Now Since we have string as an input if Now we count the length it will give the length of alphabet not the total words. For that we have to split it into list. import 'dart:io' ; main () { String ? text = stdin. readLineSync (); var lst = text!. split ( " " ); } We also want an empty list to store the unique word.  import 'dart:io' ; main () { String ? text = stdin. readLineSync (); var lst = text!. split ( " " ); var nlst = []; } Now we have to fill this empty list with the unique word which is not present in it. Currently it

To take multiple single line input in dart | dart programming | dart tutorial

 Hello friend, are you facing problem while taking integer input in dart. hey don't worry i am here. While solving many competitive problem in dart you might face this issue where you want a single command line input from the user and using those input as an integer.  The basic approach for this problem while be taking an input as a string later splitting it and forming the list. After that with the help of indexing we can extract the element of the list.  Here is the code  So here we take String k as input.  Then we form list of it as lst. Since this is string we parse it to convert it into integer. finally you can use it any where now. Thank you this was just as simple explanation. I hope you get the answer.