i am doing some machine program that our teacher. told us to do, i have figured out how to solve it, the first output is correct but the second one gives me an answer of 3.10752688172043, and the answer should be 3.75268817.
here is my code...

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

namespace BeefPrice
    class Beef
        static void Main(string[] args)
            Console.WriteLine("*********WELCOME USER**********");
            double packageA ;
            double packageB;

            double percent = 0.01;
            double ress;
            double resultA;
            double result;
            double resultB;
            double result1;
            Console.WriteLine("Price for beef package A: ");
            packageA = double.Parse(Console.ReadLine());

            Console.WriteLine("Percent for lean package A: ");
            ress  = double.Parse(Console.ReadLine());
            resultA = ress * percent;
            result = packageA / resultA ;

            Console.WriteLine("Price for beef package B: ");
            packageB = double.Parse(Console.ReadLine ());
            Console.WriteLine("Percent for lean package B: ");
            ress  = double.Parse(Console.ReadLine());
            resultB = ress * percent;
            result1 = packageA / resultB;
            Console.WriteLine("The price of package A: " + result );
            Console.WriteLine("The price of package B: " + result1 );

            if (result  < result1  )
                Console.WriteLine("The best choice is package A");

                Console.WriteLine ("The best choice is package B");
            if (result  == result1  )
                Console.WriteLine("They have the same value");




the program runs like this
price for package A:
Percent for package A:
price for package A:
Percent for package A:
The price of package A: 3.4
The price of package B: 3.75268817
The best choice is package A

Line 35 is the problem :)

commented: haha thanks :) +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.