Q:

string Program using C# language

0

This Program is used to display the current day, time using string concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;

public class Program

  {

     public static void Main()

      {

         string to,fna,lna;



         fna="C# and .";

         lna="NET Framework";



         to = fna + lna;

         Console.WriteLine("\nFull Name: {0}",to);



         //by using string constructor

         char[] letters ={'H','e','l','l','o'};

         string greetings =new string(letters);



         Console.WriteLine("\nGreetings: {0}", greetings);



          //methods returning string

          string []sarray={"Hello","From","Senthil","Velan","Dharmapuri"};

          string message =String.Join(" ",sarray);

          Console.WriteLine("\nMessage: {0}", message);



          //formatting method to convert a value

          DateTime waiting =new DateTime(2018,4,20,14,37,1);

          string chat =String.Format("Message sent at {0:t} on {0:D}", waiting);

          Console.WriteLine("\nMessage: {0}", chat);

     }

}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now