none
very simple question RRS feed

  • Question

  • im starting out computer science in my school and im stuck with one of the problems


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace _22._04._2018_2
    {
        class Program
        {
            static void Main(string[] args)
            {
    
                int b, s, bs, ss, k, t, score1, score2;
                t = 68;
                bs = 3;
                ss = 7;
                score1 = 1;
                k = 0;
                for (int ts = 1; ts <= t; ts++)
                { 
                    Console.WriteLine("enter the class code");
                    k = int.Parse(Console.ReadLine());
    // this is the problem
                    if (k = 1) 
    //it wont let me execute this command
                    {
                        Console.WriteLine("enter the number of bottles");
                        b = int.Parse(Console.ReadLine());
                        score1 = score1 + (bs * b);
                        Console.WriteLine("enter the number of batteries");
                        s = int.Parse(Console.ReadLine());
                        score1 =score1 + (ss * s);
                        Console.WriteLine(score1);
                    }
                    if 
                }
    
            }
        }
    }
    
    help is much appreciated


    Sunday, April 22, 2018 3:30 PM

Answers

All replies