DEV Community

Sanjar Rashidov
Sanjar Rashidov

Posted on

1 1 1 1 1

C# input

C# dasturlash tilida uchun Console.ReadLine() buyrug'i orqali foydalanuvchidan ma'lumot qabul qilish mumkin va bu buyruq faqat string tipiga mansub.

Agar biz butun, kasr son yoki char qabul qilmoqchi bo'lsak Convert yoki Parse qilishimiz kerak bo'ladi.

Masalan:

class Program
{
    static void Main(string[] args)
    {
        Console.Write("Ismingizni kiriting: ");
        string name = Console.ReadLine();
        Console.WriteLine("Foydalanuvchining ismi " + name);

        // String dan int ga Convert qilishni birinchi usuli
        Console.Write("1-sonni kiriting: ");
        int s1 = Convert.ToInt32(Console.ReadLine());
        Console.Write("2-sonni kiriting: ");
        int s2 = Convert.ToInt32(Console.ReadLine());
        int result1 = son1 + son2;
        Console.WriteLine("Yig'indi: " + result1);

        // String dan int ga Convert qilishni ikkinchi usul
        Console.Write("1-sonni kiriting: ");
        int n1 = int.Parse(Console.ReadLine());
        Console.Write("2-sonni kiriting:  ");
        int n2 = int.Parse(Console.ReadLine());
        int result2 = n1 + n2;
        Console.WriteLine("Yig'indi: " + result2);
    }
}
Enter fullscreen mode Exit fullscreen mode

Image of AssemblyAI tool

Challenge Submission: SpeechCraft - AI-Powered Speech Analysis for Better Communication

SpeechCraft is an advanced real-time speech analytics platform that transforms spoken words into actionable insights. Using cutting-edge AI technology from AssemblyAI, it provides instant transcription while analyzing multiple dimensions of speech performance.

Read full post

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay