Write a Dart program to create a new string from a given string (length 1 or more ) with the first character added at the front and back.

Input a string: The quick brown fox jumps over the lazy dog.
TThe quick brown fox jumps over the lazy dog.T

Code:
import 'dart:io';

void main() {
  stdout.write('Input string : ');
  String word = stdin.readLineSync();
  String result;

  result = word[0] + word + word[0];
  print(result);
}


Output:

Comments

Popular posts from this blog

Write a Dart program to convert from celsius degrees to Kelvin and Fahrenheit.

Write a Dart program to check two given integers and return true if one is negative and one is positive

Write a Dart program to compute the sum of two given integers, if two values are equal then return the triple of their sum