Q:- Q. Write a program in C# that take name and password. If the name and password are correct, the program show "you are logged in", otherwise, "incorrect name or password????
Ans- using System;
using System.Collections.Generic;
using System.Text;
namespace codeforevenorodd
{
class Program
{
static void Main(string[] args)
{
string myname = "geeta";
string pwd = "123";
Console.WriteLine("Enter user name");
string name = Console.ReadLine();
Console.WriteLine("Enter Password");
string password = Console.ReadLine();
if (name ==myname && password==pwd)
{
Console.WriteLine("You are Logged in!!!hurry");
}
else
{
Console.WriteLine("Incorrect username & password");
}
Console.ReadLine();
}
}
}
Ans- using System;
using System.Collections.Generic;
using System.Text;
namespace codeforevenorodd
{
class Program
{
static void Main(string[] args)
{
string myname = "geeta";
string pwd = "123";
Console.WriteLine("Enter user name");
string name = Console.ReadLine();
Console.WriteLine("Enter Password");
string password = Console.ReadLine();
if (name ==myname && password==pwd)
{
Console.WriteLine("You are Logged in!!!hurry");
}
else
{
Console.WriteLine("Incorrect username & password");
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment