Question #227573

Write a brief C# script that multiplies the number of recruits by 5 and stores it as the players score. The script should also deduct points when the number of recruits falls below 10 (assuming that the player is part of the team).


Expert's answer

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


namespace Q227573
{
    class Program
    {
        static void Main(string[] args)
        {


            Console.Write("Enter the number of recruits: ");
            int numberRecruits;
            int totalScores;
            int.TryParse(Console.ReadLine(), out numberRecruits);
            //multiplies the number of recruits by 5 and stores it as the players score.
            totalScores = numberRecruits * 5;
            //deduct points
            if (numberRecruits < 10)
            {
                totalScores -= (10 - numberRecruits);
            }
            Console.WriteLine("Total scores: {0}", totalScores);


            Console.ReadLine();
        }
    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS