using System.IO; using System; class IVA { static void Main() { //Programa de cálculo de IVA, elaborado por Clarisa. //declaración de variables int precio=0; int iva=0; int total=0; Console.WriteLine("Introduce el precio sin IVA."); precio=Convert.ToInt32(Console.ReadLine()); iva=Convert.ToInt32(precio*0.15); total=Convert.ToInt32(precio+iva); Console.WriteLine("El total a pagar es de $" + total + ", en el que $" + iva + " fueron del 15% de IVA del precio inicial."); Console.ReadKey(); } }
using System; using static System.Console; using System.IO; public class CreateFileOrFolder { public static void Main() { var activeDir = @"B:\Quality\QAS\FOTOS DO FERRAMENTAL"; string newPath = Path.Combine(activeDir, DateTime.Now.ToString("yyyyMMdd")); Directory.CreateDirectory(newPath); newPath = Path.Combine(newPath, Path.GetRandomFileName()); if (!File.Exists(newPath)) { //isto pode dar condição de corrida, mas vou deixar using (FileStream fs = File.Create(newPath)) { for (byte i = 0; i < 100; i++) { fs.WriteByte(i); //isto é lento pra bedéu } } } byte[] readBuffer = File.ReadAllBytes(newPath); foreach (byte b in readBuffer) { WriteLine(b); } WriteLine("Diretorio criado com sucesso, Pressione qualquer tecla para iniciar o programa de captura."); } } //https://pt.stackoverflow.com/q/238679/101
using System.IO; using System; class Program { static void Main() { Console.WriteLine("Hello"); console.writeLine("what".) } } <a href="https://tpcg.io/xKei4Y" target="_blank">Live Demo</a>
/*using System.IO; using System; class Program { static void Main() { Console.WriteLine("Hello, manhoos c# :( "); } }*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Infix { class Program { static bool convert(ref string infix, out string postfix) { int prio = 0; postfix = ""; Stack<Char> s1 = new Stack<char>(); for (int i = 0; i < infix.Length; i++) { char ch = infix[i]; if (ch == '+' || ch == '-' || ch == '*' || ch == '/') { if (s1.Count <= 0) s1.Push(ch); else { if (s1.Peek() == '*' || s1.Peek() == '/') prio = 1; else prio = 0; if (prio == 1) { if (ch == '+' || ch == '-') { postfix += s1.Pop(); i--; } else { postfix += s1.Pop(); i--; } } else { if (ch == '+' || ch == '-') { postfix += s1.Pop(); s1.Push(ch); } else s1.Push(ch); } } } else { postfix += ch; } } int len = s1.Count; for (int j = 0; j < len; j++) postfix += s1.Pop(); return true; } static void Main(string[] args) { string infix = ""; string postfix = ""; if (args.Length == 1) { infix = args[0]; convert(ref infix, out postfix); System.Console.WriteLine("InFix :\t" + infix); System.Console.WriteLine("PostFix:\t" + postfix); } else { infix = "a+b*c-d"; convert(ref infix, out postfix); System.Console.WriteLine("InFix :\t" + infix); System.Console.WriteLine("PostFix :\t" + postfix); System.Console.WriteLine(); infix = "a+b*c-d/e*f"; convert(ref infix, out postfix); System.Console.WriteLine("InFix :\t" + infix); System.Console.WriteLine("PostFix :\t" + postfix); System.Console.WriteLine(); infix = "a-b/c*d-e--f/h*i++j-/k"; convert(ref infix, out postfix); System.Console.WriteLine("InFix :\t" + infix); System.Console.WriteLine("PostFix :\t" + postfix); System.Console.WriteLine(); Console.ReadLine(); } } } }
using System.IO; using System; class Program { static void Main() { //Declaración de variables int basee, alturaa,area Console.Write ("Introduce el primer la base"); pago=Convert.Toint32(Console.Readline()); Console.Write ("Introduce la altura") area=(basee*alturaa)/2; //Imprime el resultado Console.WriteLine ("El área del triángulo es: " + area); Console.Readkey(); } }
using System.IO; using System; class Propina { static void Main() { //Programa Propina, elaborado por Clarisa. //declaración de variables int propina=0; int monto=0; Console.WriteLine("Introduce el monto de consumo del cliente."); monto=Convert.ToInt32(Console.ReadLine()); propina=Convert.ToInt32(monto*0.1); Console.WriteLine("De acuerdo a que se consumió $" + monto + ", la propina será de $" + propina); Console.ReadKey(); } }
using System.IO; using System; class Program { static void Main(string [] args) { Console.WriteLine("Este programa calcula la propina. Creado por yako"); int monto, propina; Console.WriteLine("Dame el monto a pagar"); monto = Convert.ToInt32(Console.ReadLine()); propina = monto * .10 Console.WriteLine("La propina debera ser de: $" +propina); Console.ReadKey(); } }
using System.IO; using System; class Program { static string input = ""; static string description = ""; static void Main() { input = Console.ReadLine(); string[] splitInput = input.Split('>'); description = splitInput[0]; Console.WriteLine("Description: " + description); for(int i = 1; i < splitInput.Length; i++) { understand(splitInput[i].ToLower()); } } static void understand(string line) { if(line.StartsWith("implying")) { string[] splitLine = line.Split(' '); if(splitLine[1] == "i" && splitLine[2] == "won't") { if() } } else Console.WriteLine("ERR"); } public struct variable { string value; public variable(string type) { value = type + ":"; } } }
using System.IO; using System; class Program { static void Main() { Console.WriteLine("Fizz Buzz problem"); for (int i = 1; i <= 100; i++) { if (((i % 3) == 0) && ((i % 5) == 0)) { Console.WriteLine("FizzBuzz"); } else if ((i % 3) == 0) { Console.WriteLine("Fizz"); } else if ((i % 5) == 0) { Console.WriteLine("Buzz"); } else { Console.WriteLine("{0}", i); } } } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more