0% found this document useful (0 votes)
30 views4 pages

Using Using Using Using Namespace Class Static Void String Int Int Do Int If If

This document contains code written in C# for several different programs: 1. A program that takes a 4-digit number as input and checks if it is a palindrome by comparing the first and last digits and middle two digits. 2. A program that prints out a multiplication table for a given number. 3. A program that takes a sentence as input and outputs the words in reverse order.

Uploaded by

Herrera Isacc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

Using Using Using Using Namespace Class Static Void String Int Int Do Int If If

This document contains code written in C# for several different programs: 1. A program that takes a 4-digit number as input and checks if it is a palindrome by comparing the first and last digits and middle two digits. 2. A program that prints out a multiplication table for a given number. 3. A program that takes a sentence as input and outputs the words in reverse order.

Uploaded by

Herrera Isacc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CAPICUA CON 4 NUMEROS using System; using System.Collections.Generic; using System.Linq; using System.

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(); } } }

You might also like