CS
cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//Exploring modulus
//
//trying to find out if it is allowed to calculate modulus with floating type numbers
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
int num1, num2;
double num3, num4;
// num1 = 1.25 / 0.5;
// num2 = 1.25 % 0.5;
num3 = 1.25 / 0.5;
num4 = 1.25 % 0.5;
//Console.WriteLine(num1); // cannot implicitly convert a double to a int
//Console.WriteLine(num2);// cannot implicitly convert a double to a int
Console.WriteLine(num3);
Console.WriteLine(num4);//it is allowed if the result is of type double
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run