Using Using Using Using Namespace Class Static Void String Int Int Do Int If If
Using Using Using Using Namespace Class Static Void String Int Int Do Int If If
Using Using Using Using Namespace Class Static Void String Int Int Do Int If If
Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int temp; int n, a, b, c, d; do{ Console.WriteLine("Ingrese numero:"); n = int.Parse(Console.ReadLine()); if (n > 0) { if(n<10){ Console.WriteLine("Un solo numero no puede ser capicua"); } if ((n >= 10) && (n < 99)) { a = n / 10; temp = n % 10; b = temp; if (a == b) { Console.WriteLine("El numero: {0} SI es capicua", n); } else { Console.WriteLine("El numero: {0} NO es capicua", n); } } if ((n >= 100) && (n <= 999)) { a = n / 100; temp = n % 100; b = temp/10; temp=temp%10; c = temp; if (a == c) { Console.WriteLine("El numero: {0} SI es capicua", n); } else if (a != c) { Console.WriteLine("El numero: {0} NO es capicua", n); } } if ((n >= 1000) && (n < 9999)) { a = n / 1000; temp = n % 1000; b = temp / 100; temp = temp % 100; c = temp/10;
temp = temp % 10; d = temp; if ((a == d) && (b == c)) { Console.WriteLine("El numero: {0} SI es capicua", n); } else if ((a != d) && (b != c)) { Console.WriteLine("El numero: {0} NO es capicua", n); } } } if(n<0) { Console.WriteLine("ERROR"); } } while(n!=0); } } }
Tabla de dividir
using using using using System; System.Collections.Generic; System.Linq; System.Text;
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int n; Console.Write("N:"); n = int.Parse(Console.ReadLine()); if (n > 0) { int mos, div; div = n * 10; while (div >= 0) { mos = div / n; Console.Write("{0}/{1}={2}", div, n, mos); div = div - n; Console.ReadLine(); } } } } }
Voltador de prrafo
using using using using System; System.Collections.Generic; System.Linq; System.Text;
using System; namespace problema_36_con_clases { /// <summary> /// Summary description for Class1. /// </summary> class cinversion { string oracion; string resultado = ""; public string Resulatdo { get { return resultado; } } public cinversion(string cadena) { oracion = cadena; procesa(); } private void procesa() { int pos; string palabra; for (; oracion.Length > 0; ) { pos = oracion.IndexOf(' '); if (pos >= 0) { palabra = oracion.Substring(0, pos); oracion = oracion.Substring(pos + 1); } else { palabra = oracion; oracion = ""; } resultado = palabra + ' ' + resultado; } } }
class Class1 { static void Main() { string cadena; Console.WriteLine("Ingrese cadena:"); cadena = Console.ReadLine(); cinversion c = new cinversion(cadena); Console.WriteLine("Resultado : {0}", c.Resulatdo); Console.ReadLine(); } } }