Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

wrong in if C#

$
0
0
            double pris, skatt;

            Console.Write("Skriv in hur mycket du tjänar: ");
            pris = double.Parse(Console.ReadLine());
            if (10000<50000)
            {
                skatt = 0.5;
                Console.WriteLine("\nDin skatt är " + pris * skatt);
            }
            else if (50000<100000)
            {
                skatt = 0.5;
                Console.WriteLine("\nDin skatt är " + pris * skatt + 5000);
            }
            else if (100000>pris)
            {
                skatt = 0.7;
                Console.WriteLine("\nDin skatt är " + pris * skatt + 5000);
            }
            else
            {
                Console.WriteLine("\nDu behöver inte betala någon skatt");
            }

            Console.ReadLine();
        }
    }
}


when i type in a number between 10000 - 50000 it going to take the number and * it whit 0.5.
and the secound it going to * 0.5 between a number 50000 - 100000 and + 5000.
and the theerd it going to look for a number 100000 and higher and ' 0.7 and + 5000.
and if the number is under 10000 it only going to type out a text. i tryd changing the pris in to a int but when i do it it com up Unreachable code detected in the error field on the else if.

so what im i doing wrong in this code

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>