DEV Community

Mushtariy
Mushtariy

Posted on

4 3 3 3 4

Input

"Console.ReadLine()" - input qilish uchun kerak.

"Console.ReadLine()" - faqat stringga ishlaydi.

int, double, float, char lar bilan input ishlatish uchun.int a = Convert.ToInt32(Console.ReadLine());

Convert.To.va data type yoziladi.

Interpolation - bu qo'shtirnoq ichida o'zgaruvchilardan foydalanish imkoniyatini beradi.

$" " - oldindan bu belgini foydalanish kerak

Double ga misol:

Console.Write("Biror bir xaqiqiy son kiirting: ");
double kasrSon = Convert.ToDouble(Console.ReadLine());
Console.WriteLine($"Kiritilgan kasrSon: {kasrSon}");
Enter fullscreen mode Exit fullscreen mode

Char ga misol:

Console.Write("Biror bir belgi kiirting: ");
char belgi = Convert.ToChar(Console.ReadLine());
Console.WriteLine($"Kiritilgan belgi: {belgi}");
Enter fullscreen mode Exit fullscreen mode

Misol:

class Program
{
    static void Main()
    {
        Console.Write("Mashinangiz bormi? (ha/yo'q): ");
        string javob = Console.ReadLine().ToLower();
        bool mashinaBor = javob == "ha";

        if (mashinaBor)
        {
            Console.WriteLine("Sizning mashinangiz bor.");
        }
        else
        {
            Console.WriteLine("Sizning mashinangiz yo'q.");
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (1)

Collapse
 
sabrina_abcdna123 profile image
Sabrina

YORVORATION

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay