You are on page 1of 1

using System;

public class Program


{
public static void Main()
{
while (true) // Loop indefinitely
{

Console.WriteLine("Enter input:"); // Prompt


string line = Console.ReadLine(); // Get string from user
int index1 = line.IndexOf('7');
if (!(line.Contains("7"))) // Check string
{
Console.WriteLine("Enterd number does not contains 7");
Console.WriteLine(" Press 'Y' to re enter your number and
Press 'N' to exit" );
string li = Console.ReadLine();

if(li.Contains("N"))
{
break;
}

else if( index1==3)


{
Console.WriteLine("You typed number contains 7 at index 3
"); // Report output
}

else {

Console.Write("You typed number contains at index


{0}",index1); // Report output

}
}
}

}
}

You might also like