Skip to content

Instantly share code, notes, and snippets.

View Brianceasar's full-sized avatar
🖥️
coding + learning

Brian Ceasar Brianceasar

🖥️
coding + learning
View GitHub Profile

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@Brianceasar
Brianceasar / DigitToWords.cs
Created November 30, 2022 06:35
A program that asks for a digit (0-9), and depending on the input, shows the digit as a word (in English)
class Program
{
static void Main(string[] args)
{
Console.Write("Enter a number: ");
int number = Int32.Parse(Console.ReadLine());
switch (number)
{
case 0: Console.WriteLine("Zero"); break;
@Brianceasar
Brianceasar / Sort3NumbersWithNestedIfs.cs
Created November 30, 2022 06:34
A program that sorts 3 real numbers in descending order using nested if-statement
class Program
{
static void Main(string[] args)
{
Console.Write("Enter first number: ");
int a = Int32.Parse(Console.ReadLine());
Console.Write("Enter second number: ");
int b = Int32.Parse(Console.ReadLine());
Console.Write("Enter third number: ");
int c = Int32.Parse(Console.ReadLine());
@Brianceasar
Brianceasar / PrintSumOfFiveIntegers.cs
Created November 30, 2022 06:32
program that reads five integer numbers and prints their sum. If an invalid number is entered the program should prompt the user to enter another number.
class program
{
static void Main(string[] args)
{
int a,b,c,d,e;
Console.Write("Enter first number: ");
bool isaInt = int.TryParse(Console.ReadLine(), out a);
Console.Write("Enter second number: ");
bool isbInt = int.TryParse(Console.ReadLine(), out b);
@Brianceasar
Brianceasar / FibonacciSequence.cs
Last active November 30, 2022 06:29
Program that prints the first 100 members of the sequence of Fibonacci: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, …
namespace FibonacciSequence
{
class Program
{
static void Main()
{
BigInteger newElement;
BigInteger[] sequenceMembers = { 0, 1 };
Console.Write("{0},\n{1},\n", sequenceMembers[0], sequenceMembers[1]);
for (int i = 0; i < 98; i++)
@Brianceasar
Brianceasar / PrintNNumbers.cs
Last active November 30, 2022 06:29
Program that reads an integer number n from the console and prints all the numbers in the interval [1..n], each on a single line.
namespace PrintNNumbers
{
class Program
{
static void Main (string[] args)
{
int n;
Console.Write("Enter the first number n: ");
bool isInt = int.TryParse(Console.ReadLine(), out n);
@Brianceasar
Brianceasar / AgeAfterTenYears.cs
Last active November 30, 2022 06:30
Program that reads age from console and prints result after 10 years.
namespace AgeAfterTenYears
{
class AgeAfterTen
{
static void Main (string[] args)
{
Console.Write("Input your current age: ");
int age = Convert.ToInt32(Console.ReadLine());
@Brianceasar
Brianceasar / FirstOneHundred.cs
Last active November 30, 2022 06:30
Program that prints the first 100 members of the sequence 2, -3, 4, -5, 6, -7, 8...
for (int i = 2; i < 101; i++)
{
if (i % 2 == 0)
{
Console.Write("{0} ", i);
}
else
{
Console.Write("{0} ", -i);
}