Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,109 questions

40,779 answers

573 users

How to use floor in C#

2 Answers

0 votes
using System;

class Program
{
    static void Main() {
        float f1 = 1.1f, f2 = 1.5f, f3 = 1.6f, f4 = 1.9f, f5 = 0.01f;
        
        Console.WriteLine(Math.Floor(f1));
        Console.WriteLine(Math.Floor(f2));
        Console.WriteLine(Math.Floor(f3));
        Console.WriteLine(Math.Floor(f4));
        Console.WriteLine(Math.Floor(f5));
    }
}




/*
run:
 
1
1
1
1
0
 
*/

 





answered Jun 9, 2022 by avibootz
0 votes
using System;

class Program
{
    static void Main() {
        float f1 = -1.1f, f2 = -1.5f, f3 = -1.6f, f4 = -1.9f, f5 = -0.01f;
        
        Console.WriteLine(Math.Floor(f1));
        Console.WriteLine(Math.Floor(f2));
        Console.WriteLine(Math.Floor(f3));
        Console.WriteLine(Math.Floor(f4));
        Console.WriteLine(Math.Floor(f5));
    }
}




/*
run:
 
-2
-2
-2
-2
-1

*/

 





answered Jun 9, 2022 by avibootz

Related questions

1 answer 59 views
59 views asked Dec 2, 2020 by avibootz
1 answer 68 views
1 answer 24 views
...