What will be the output of the following C# code?

string s1 = " I AM BEST ";
string s2;
s2 = s1.substring (5, 4);
Console.WriteLine (s2);

a) AM BEST
b) I AM BES
c) BEST
d) I AM

1 thought on “What will be the output of the following C# code?”

  1. c
    Explanation: Substring() of string class used to extract substrings from given string. In the given substring condition, it extracts a substring beginning at 5th position and ending at 4th position.
    Output:
    BEST

Leave a Comment