0% found this document useful (0 votes)
14 views2 pages

constante //variable: Console Console Console Console

The document contains 4 code snippets that prompt the user for input, perform calculations or comparisons on the input, and output results based on conditional logic. The first snippet asks for a name and age, checks if the age is over 18, and prints a message and name if so. The second asks for two numbers, checks if their sum is even, and prints a message accordingly. The third similarly asks for two numbers, calculates their sum, and prints the operation and result if the sum is negative. The fourth asks for a single number, checks its value against ranges, and prints how many digits it contains based on the range checks.

Uploaded by

17Atticus
Copyright
© © All Rights Reserved
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)
14 views2 pages

constante //variable: Console Console Console Console

The document contains 4 code snippets that prompt the user for input, perform calculations or comparisons on the input, and output results based on conditional logic. The first snippet asks for a name and age, checks if the age is over 18, and prints a message and name if so. The second asks for two numbers, checks if their sum is even, and prints a message accordingly. The third similarly asks for two numbers, calculates their sum, and prints the operation and result if the sum is negative. The fourth asks for a single number, checks its value against ranges, and prints how many digits it contains based on the range checks.

Uploaded by

17Atticus
Copyright
© © All Rights Reserved
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/ 2

//constante

//variable
string Nombre , e;
int Edad;
Console.WriteLine("ingrese el Nombre");
Nombre = Console.ReadLine();
Console.WriteLine("ingrese la edad");
e = Console.ReadLine();
Edad =int.Parse(e);
if (Edad >=18) //condicion
{
Console.WriteLine("es mayor de edad");
Console.Write(Nombre);
}
Console. ReadKey();
}




//CONSTANTE
//VARIABLES
int A1, B1;
string a; b;
Console.WriteLine("ingrese el primer numero");
a = Console.ReadLine();
A1 = int.Parse(a);
Console.WriteLine("ingrese el segundo numero");
b = Console.ReadLine();
B1 = int.Parse(b);

if ((A1 + B1) % 2 == 0) //condicion //reto igual a cero
{
Console.WriteLine("la suma es par");
}
Console.ReadKey();

}




//variable
double A, B, S;
string a, b;
Console.WriteLine("ingrese el primer numero");
a = Console.ReadLine();
A = double.Parse(a);
Console.WriteLine("ingrese el segundo numero");
b = Console.ReadLine();
B = double.Parse(b);
S = A + B;
if (S < 0) //condicion
{
Console.WriteLine("-----------");
Console.WriteLine("vizualizando la suma");
Console.WriteLine("-------------");
Console.WriteLine(A);
Console.WriteLine("+");
Console.WriteLine(B);
Console.WriteLine("----");
Console.WriteLine(S);
}
Console.ReadKey();





/constante
//variable
string a;
double A;
Console.WriteLine("ingrese un numero");
a = Console.ReadLine();
A = int.Parse(a);
if (A > 0) //condicion
{
if (A < 10) //condicion
Console.WriteLine("tiene un dijito");
}
{
if (A < 100) //condicion
if (A > 9) //condicion
Console.WriteLine("tiene dos dijitos");
}
{
if (A < 1000) //condicion
if (A > 99) // condicion

Console.WriteLine("tiene tres dijitos");
}
Console.ReadKey();

You might also like