Answers for "divide int in c#"

C#
1

divide int in c#

using System;

namespace Divide{
  
  public class Program{

      public static int division(int a, int b){
          return (a/b);
      }

      public static void Main(){
          int a,b;
          int quotient;

          Console.Write("Enter first number: ");
          a = Convert.ToInt32(Console.ReadLine());

          Console.Write("Enter second number: ");
          b = Convert.ToInt32(Console.ReadLine());

          quotient = division(a,b);

          Console.WriteLine("Quotient is: " + quotient);
		}
  	}
}
Posted by: Guest on August-28-2021
0

divide 3 numbers c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Demo {
   class MyApplication {
      static void Main(string[] args) {
         int num;
         num = 15;

         Console.WriteLine("Number: "+num);

         // checking if the number is divisible by 3 and 5
         if (num % 3 == 0 && num % 5 == 0) {
            Console.WriteLine("Divisible by 3 and 5");
         } else {
            Console.WriteLine("Not divisible by 3 and 5");
         }
         Console.ReadLine();
      }
   }
}
Posted by: Guest on October-11-2020

C# Answers by Framework

Browse Popular Code Answers by Language