Write a C# Sharp program to accept two integers and check whether they are equal or no

  • برمجة سي شارب
  • برمجة

Write a C# Sharp program to accept two integers and check whether they are equal or no

Sample Output:

Check whether two integers are equal or not:                                                               
-------------------------------------------    
Input 1st number: 20                                                                                          
Input 2nd number: 20                                                                                          
20 and 20 are equal.

الأجوبة

using System;  
public class Exercise1  
{  
    public static void Main()  
    {  
        int int1,int2;
         Console.Write("\n\n");
         Console.Write("Check whether two integers are equal or not:\n");
         Console.Write("-------------------------------------------");
         Console.Write("\n\n");
        Console.Write("Input 1st number: ");  
        int1= Convert.ToInt32(Console.ReadLine());  

        Console.Write("Input 2nd number: ");  
        int2= Convert.ToInt32(Console.ReadLine());  

    if (int1 == int2)
        Console.WriteLine("{0} and {1} are equal.\n",int1,int2);
    else
        Console.WriteLine("{0} and {1} are not equal.\n",int1,int2);
   }  
} 

 
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...