GithubHelp home page GithubHelp logo

isaac6732 / selection-statements-exercise Goto Github PK

View Code? Open in Web Editor NEW

This project forked from truecodersio/selection-statements-exercise

0.0 0.0 0.0 163 KB

.NET 6.0 template project for the Selection Statements exercise at TrueCoders

C# 100.00%

selection-statements-exercise's Introduction

Exercise 1:

Create a program that allows a user to play a game where they must guess what your favorite number is:

  • Initialize an integer to represent a favorite number and assign a value with a number of your choosing or you can assign a random number to this variable:
var r = new Random();
var favNumber = r.Next(1,1000);
var userInput = int.Parse(Console.ReadLine());

The following code will allow the user to guess what your favorite number is:

var userInput = int.Parse(Console.ReadLine());
  • Create an if-statement that if the guessed number is below the initial value, print out “too low”.

  • Create an else-if statement that if the number is higher than the initial value, print out “too high”.

  • Create an else statement that prints out some type of congratulations for guessing the correct number e.g. “You guessed it!!!”.

Remember to save, commit, and push back to Github once complete

Extra Switch Statement Practice:

https://www.codewars.com/kata/568dc014440f03b13900001d/train/csharp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.