It looks like you're new here. If you want to get involved, click one of these buttons!
Hey everyone!
Here is my solution to the challenge from the C# Tutorial 02 (Variables) video that is out this Sunday.
Have fun with it! 😀
using System; namespace My_Awesome_Program { class Program { static void Main(string[] args) { // Declare variables double num01; double num02; double num03; // Get first number Console.Write("Input a number: "); num01 = Convert.ToDouble(Console.ReadLine()); // Get second number Console.Write("Input a second number: "); num02 = Convert.ToDouble(Console.ReadLine()); // Get third number Console.Write("Input a third number: "); num03 = Convert.ToDouble(Console.ReadLine()); // Calculate and display the average double result = (num01 + num02 + num03) / 3; Console.WriteLine("The average of these numbers is " + result); // Wait before closing Console.ReadKey(); } } }
Comments
I also did it
Did I went too far?
Hey there all! Here's my answer to challenge #2...
I made this program in phone and by mistake posted it in the challenge 03 but its fine.
using System;
namespace JAIVINs_PROGRAM
{
public static class Program
{
public static void Main()
{
double num02;
double num03;
double num01;
double average;
Console.WriteLine("This is a average calculator enter your number to prceed");
Console.Write("Enter the first number =>");
num01 = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the second number =>");
num02 = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the third number =>");
num03 = Convert.ToDouble(Console.ReadLine());
average = (num01 + num02 + num03) / 3;
Console.Write("This is the final result =>" + average );
Console.ReadKey();
}
}
}
is this ok
using System;
namespace Challenge_2
{
class Program
{
static void Main(string[] args)
{
//Variables
double num1;
double num2;
double num3;
double Average;
//--------------------------------------------------------------------------------------------------\\
//Additional Text
Console.WriteLine("Enter Three Numbers To Take Out Their Average.\n\n\n");
//---------------------------------------------------------------------------------------------------\\
//Assigning Value To Variables
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Enter Your First Number: ");
Console.ForegroundColor = ConsoleColor.Cyan;
num1 = Convert.ToDouble( Console.ReadLine() );
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Enter Your Second number: ");
Console.ForegroundColor = ConsoleColor.Cyan;
num2 = Convert.ToDouble( Console.ReadLine() );
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Enter Your third number: ");
Console.ForegroundColor = ConsoleColor.Cyan;
num3 = Convert.ToDouble( Console.ReadLine() );
//---------------------------------------------------------------------------------------------------\\
//calculating The Average Of The Numbers
Average = (num1 + num2 + num3) / 3;
//Giving The Answer
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("The Average Of The Three Numbers Is: " + Average);
//----------------------------------------------------------------------------------------------------\\
//Wait Before Closing
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("\n\nPress Any Key To Continue.");
Console.ReadKey();
}
}
}
can Anyone tell me how to upload the code with colors like Brackeys do??
using System;
namespace _4
{
class Program
{
static void Main(string[] args)
{
Console.Title = "BeanOS#2";
Console.WriteLine("Hi I am Bean2OS. What is your name?");
string dyson = Console.ReadLine();
Console.WriteLine($"\nHow are you doing {dyson}");
Console.ReadLine();
// you can declare some string and then equate it toa readline so that the console notices you senpai
Console.WriteLine("\nThat is great to hear");
Console.ReadLine();
double uno;
double deus;
double tres;
Console.WriteLine("\nI'm going to do some mathematical magic\nready?");
Console.ReadLine();
Console.Write($"\nCan i get your first number {dyson}: ");
uno = Convert.ToDouble( Console.ReadLine());
Console.Write($"\nCan i get your second number {dyson}: ");
deus = Convert.ToDouble( Console.ReadLine());
Console.Write($"\nCan i get your third number {dyson}: ");
tres = Convert.ToDouble( Console.ReadLine());
Console.WriteLine($"\nThank you for your input {dyson}");
Console.ReadLine();
double endgame = (uno*deus*tres)/3;
Console.WriteLine($"\nHere is the result of your calculation {endgame}.");
Console.ReadLine();
Console.WriteLine("My trick was simple.\nAll I did was take your numbers\nmultiply them \nand find the average");
Console.ReadLine();
Console.WriteLine("\nRemember to have a good day and smile.\n Good Day");
Console.ReadKey();
}
}
}
This took me less than 5 minuets to make. I also like to give my projects personality.
using System;
namespace Program_1._1
{
class Program
{
static void Main(string[] args)
{
// This text is useless
Console.Title = "The Mystery Program";
Console.ForegroundColor = ConsoleColor.Cyan;
double num01;
double num02;
double num03;
Console.WriteLine("Welcome to The Mystery Program.\nWhat I do, what I'm named, and what I say may change at any point in time. \nSo \n. \n. \n. \nWhat is your name?");
string userName = Console.ReadLine();
Console.WriteLine("Hello, " + userName + ", my name is D.O.M. \nShort for Don't Overide Me. \nThis program is a calculator right now. \nI can only average three numbers. \nWhat is the first number you would like?");
num01 = Convert.ToDouble( Console.ReadLine() );
Console.WriteLine("You entred " + num01 + "! \nWhat is the second number?");
num02 = Convert.ToDouble( Console.ReadLine() );
Console.WriteLine("You entred " + num02 + "\nPlease enter your third number");
num03 = Convert.ToDouble( Console.ReadLine() );
Console.WriteLine("You entred " + num03 + "\nYour answer is " + (num01 + num02 + num03) / 3 +"!\nPress any key to close");
Console.ReadKey();
}
}
}
Here Is Mine
Here's mine, just wanted to specify that the user can now input any amount of averages ;)
using System;
using System.Collections.Generic;
namespace Brackeys_average
{
class Program
{
static void Main(string[] args)
{
List<double> doubles = new List<double>();
Console.Write("Input how many numbers you want to average: ");
int times = (Convert.ToInt32(Console.ReadLine()));
for(int i = 0; i < times; i++)
{
Console.Write("Input a number: ");
doubles.Add(Convert.ToDouble(Console.ReadLine()));
}
double length = doubles.Count;
double avg = 0;
for (int i = 0; i < length; i++)
{
avg += doubles[i];
}
avg /= length;
Console.WriteLine("Your result is: " + avg);
}
}
}
Can somebody help me post my work pls?
is it ok to post it like that? Also is my first time and im 10 years old so pls corect me if im wrong with something
using System;
namespace Primul_program
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Hi";
Console.ForegroundColor = ConsoleColor.Green ;
Console.Write("Wanna see a magic trick?");
double num01;
double num02;
double num03;
Console.Write("Say a number: ");
num01 = Convert.ToDouble ( Console.ReadLine() );
Console.Write("Now another one: ");
num02 = Convert.ToDouble ( Console.ReadLine() );
Console.WriteLine("And another one.");
num03 = Convert.ToDouble ( Console.ReadLine() );
double result = num01 + num02 + num03 ;
double finalResult = result/3;
Console.WriteLine("So i calculated in a way that I will find the average of these three numbers and the average of them is " + finalResult );
Console.WriteLine("Silly me.I forgot to ask your name.So whats your name?");
string userName = Console.ReadLine();
Console.WriteLine("I like the name " + userName +" .It is nice.My name is Andrew.");
Console.Write("Sooo...what now?");
Console.Write("Oh i know:a story.");
Console.WriteLine("Uhm.. so lets say that our hero,named(pst, now you say a name)");
string heroName = Console.ReadLine();
Console.WriteLine(heroName + ", I think we can go with that.");
Console.WriteLine("Now say a location.");
string placeName = Console.ReadLine();
Console.WriteLine("Where were we?Oh right.So " + heroName + " is at a place named " + placeName + ".");
Console.WriteLine("Now im gonna end bc I ran out of imagination.");
Console.WriteLine("Bye " + userName + ".See?I did not forget your name.");
//wait before close
Console.ReadKey();
}
}
}
Sooooo.....
I'm a bit late but....
And i messed around with the script a bit and I had a Calculator and something that you can calculate the average 3 numbers...
So here is my script:
Im not sure how to post it correctly...
using System;
namespace AMK
{
class Program
{
static void Main(string[] args)
{
double num1;
double num2;
double num3;
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Zahl einfügen: ");
num1 = Convert.ToDouble(Console.ReadLine() );
Console.Write("\nZweite Zahl einfügen: ");
num2 = Convert.ToDouble(Console.ReadLine() );
Console.Write("\nDritte Zahl einfügen: ");
num3 = Convert.ToDouble(Console.ReadLine() );
double Ergebnis = (num1 + num2 + num3) / 3 ;
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("\nDer Durchschnitt ist " + Ergebnis);
Console.ReadKey();
}
}
}
@Hubi and @Victor2111 you can click the "P"-like thing on the left and select "" Quote". There should be a "</> Code Block" under it
This is how I did it
using System;
namespace Average
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Average";
Console.ForegroundColor = ConsoleColor.Blue;
Console.WindowHeight = 40;
double num01;
double num02 ;
double num03;
double total;
double result;
Console.WriteLine("Enter a Number :");
num01 = Convert.ToDouble( Console.ReadLine() );
Console.WriteLine("Enter another number :");
num02 = Convert.ToDouble( Console.ReadLine() );
Console.WriteLine("Enter another number :");
num03 = Convert.ToDouble( Console.ReadLine() );
total = num01 + num02 + num03;
result = total/3;
Console.WriteLine("The Average of the three numbers is");
Console.WriteLine(result);
Console.ReadKey();
}
}
}
using System;
namespace Average_Calculator
{
class Program
{
static void Main()
{
double num1;
double num2;
double num3;
double sum;
double average;
string restart;
Console.Title = "Average Calculator";
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Insert the first number:");
num1 = Convert.ToDouble(Console.ReadLine());
Console.Write("Insert the second number:");
num2 = Convert.ToDouble(Console.ReadLine());
Console.Write("Insert the third number:");
num3 = Convert.ToDouble(Console.ReadLine());
sum = num1 + num2 + num3;
average = sum / 3;
Console.Write("The Average is " + average);
Console.Write("\nPress R to restart: ");
restart = Console.ReadLine();
if (string.Equals(restart, "R"))
{
Console.Clear();
Main();
}
if (string.Equals(restart, "r"))
{
Console.Clear();
Main();
}
}
}
}
I used a little simpler way :)
also multiplied and used int(32) XD
using System;
namespace My_awesome_project
{
class Program
{
static void Main(string[] args)
{
double num1; //all numbers
double num2;
double num3;
double num4 = 3;
Console.Write("Napiš číslo: ");
num1 = Convert.ToDouble( Console.ReadLine() ); //first
Console.Write("Napiš druhé číslo: "); //second
num2 = Convert.ToDouble( Console.ReadLine() );
Console.Write("Napiš poslední číslo: "); //third
num3 = Convert.ToDouble(Console.ReadLine() );
double result = num1 + num2 + num3 ; //result
Console.WriteLine("Tady je výsledek: " + result / num4 );
Console.ReadKey(); //close
}
}
}
Ye, it was pretty easy. Code:
using System;
namespace VSCODEPROJ
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Average Meter (4 Numbers Edition)";
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WindowHeight = 35;
double no1;
double no2;
double no3;
double no4;
Console.WriteLine("What is the first number???");
no1 = Convert.ToDouble( (Console.ReadLine() ));
Console.WriteLine("What is the second number???");
no2 = Convert.ToDouble( (Console.ReadLine() ));
Console.WriteLine("What is the third number???");
no3 = Convert.ToDouble( (Console.ReadLine() ));
Console.WriteLine("What is the fourth / last number???");
no4 = Convert.ToDouble( (Console.ReadLine() ));
// add how much you want
double result = (no1 + no2 + no3 + no4) / 4;
Console.WriteLine("The average beetween this 4 numbers is " + result);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
// Made by MrDarkTime. Please don't try to copy this. It's bad.
}
}
}
This is how I did mine
using System;
namespace Awesome_Program
{
class Program
{
static void Main(string[] args)
{
double num01;
double num02;
double num03;
Console.Write("Input a number: ");
num01 = Convert.ToDouble( Console.ReadLine() );
Console.Write("Input a second number ");
num02 = Convert.ToDouble( Console.ReadLine() );
Console.Write("Input a third number ");
num03 = Convert.ToDouble( Console.ReadLine() );
double result = num01 + num02 + num03;
double average = result / 3;
Console.WriteLine("The average of the numbers is " + average);
// Wait before closing
Console.ReadKey();
}
}
}
using System;
namespace My_First_Code
{
class Program
{
static void Main(string[] args)
{
int num1;
int num2;
int num3;
Console.Write("write number1: ");
num1 = Convert.ToInt32( Console.ReadLine() );
Console.Write("write number2: ");
num2 = Convert.ToInt32(Console.ReadLine() );
Console.Write("write number3: ");
num3 = Convert.ToInt32(Console.ReadLine());
int result = (num1 + num2 + num3) / 3;
Console.WriteLine("the result is " + result);
// the end
Console.ReadKey();
}
}
}
using System;
namespace _4
{
class Program
{
static void Main(string[] args)
{
Console.BackgroundColor = ConsoleColor.DarkGray;
Console.Title = "Can i still code?";
string yos = "jormagund";
double a;
double b;
double c;
Console.Write("gimme a number any number :");
a = Convert.ToDouble( Console.ReadLine());
Console.Write("nexxxxt number:");
b = Convert.ToDouble(Console.ReadLine()) ;
Console.Write("nexxxxt number:");
c = Convert.ToDouble(Console.ReadLine()) ;
Console.WriteLine("hey i really like this word "+yos);
Console.ReadLine();
Console.WriteLine("imma add these numbers ... and do some other stuff widit");
Console.ReadLine();
double d = (a+b+c)/3 ;
Console.WriteLine("here's your average"+d);
Console.ReadKey();
}
}
}
Here is my solution to the challenge:
Double num1;
Double num2;
Double num3;
//Input Number 1
Console.Write("Input no.1: ");
num1 = Convert.ToDouble(Console.ReadLine());
//Input Number 2
Console.Write("Input no.2: ");
num2 = Convert.ToDouble(Console.ReadLine());
//Input Number 3
Console.Write("Input no.3: ");
num3 = Convert.ToDouble(Console.ReadLine());
Double add = num1 + num2 + num3;
Double result = add / 3;
Console.WriteLine("The Average is " + result );
Console.ReadKey();