What's new

C# Pahelp po saan Mali dito?

G O Z A R U

Forum Expert
Elite
Joined
Apr 7, 2017
Posts
7,994
Solutions
1
Reaction
4,324
Points
2,365
Ano po mali dito ?

Gagayahin kasi namin tong sa pic.
IMG_20211109_115708.jpg


C#:
class Program
{
          
          static void Main(string[ ] args)
          {
          double firstnum;
          double secondnum;
          double answer;
          string ops;
          
                Console.Writeline("Enter num1:");   
                 firstnum = Double.parse(Console.ReadLine());
      
                
                 Console.Writeline("Enter your desired operator: {+}, {-}, {*}, {/} ");   
                 ops = Console.ReadLine();
                 Console.Readkey();

                  Console.Writeline("Enter num2:");   
                 firstnum = Double.parse(Console.ReadLine());
                
                 if(ops == "+")
                 {
                  asnwer = firstnum + secondnum;
                  Console.Write(answer);
                 }
                 if(ops == "-")
                 {
                  asnwer = firstnum - secondnum;
                  Console.Write(answer);
                 }
                 if(ops == "*")
                 {
                  asnwer = firstnum * secondnum;
                  Console.Write(answer);
                 }
                 if(ops == "/")
                 {
                  asnwer = firstnum / secondnum;
                  Console.Write(answer);
                 }
                  Console.ReadKey();
  
          
         }

     }

}
 

Attachments

Dami pala error dyan eto ok na Haha
Pa mark as solutionYou do not have permission to view the full content of this post. Log in or register now. naman para hindi sayang effort ko, salamat


C#:
 class Program
    {
        static void Main(string[] args)
        {
            double firstnum;
            double secondnum;
            double answer;
            string ops;

            Console.WriteLine("Enter num1:");
            firstnum = Double.Parse(Console.ReadLine());

            Console.WriteLine("Enter num2:");
            secondnum = Double.Parse(Console.ReadLine());

            Console.WriteLine("Enter your desired operator: {+}, {-}, {*}, {/} ");
            ops = Console.ReadLine();


            if (ops == "+")
            {
                answer = firstnum + secondnum;
                Console.WriteLine(" The sum of " + firstnum + " and " + secondnum + " is " + answer);
            }
            else if (ops == "-")
            {
                answer = firstnum - secondnum;
                Console.WriteLine(" The sum of " + firstnum + " and " + secondnum + " is " + answer);
            }
           else if (ops == "*")
            {
                answer = firstnum * secondnum;
                Console.WriteLine(" The sum of " + firstnum + " and " + secondnum + " is " + answer);
            }
           else
            {
                answer = firstnum / secondnum;
                Console.WriteLine(" The sum of " + firstnum + " and " + secondnum + " is " + answer);
            }
            Console.ReadKey();

        }

    }


phcbryan16.PNG

phcbryan.PNG

phcbryan1.PNG
 

Attachments

try to review your code ts. make sure na na declare mo yung mga variables na ginagamit mo. example "asnwer" na ginamit mo to store the result of mathematical operation is hindi pareho yung na declare mo sa itaas is "double answer". syntactically incorrect/wrong spelling nalang para madali. parang ganito.ts pinangalanan mo aso mo ng brownie pero tawag mo brown. sa programming ts sensitive po ito kung ano tawag mo sa variables mo during declaration mo dapat pag tinawag mo na within the program dapat same din ang spelling. kuha mo ts? kaw nga nagagalit pag mali tawag sayo ng prof mo. tapos sasabihin mo sir/mam mali ho yan ito po yung pangalan ko, ganyan din sa programming ts. apaka sensitive nito..
 

Similar threads

Back
Top