« en: 18 de Julio 2016, 20:40 »
Ejercicio:
Write a program that does the following:
Reads an integer number from the console.
Stores in a variable if the number can be divided by 7 and 5 without remainder.
Prints on the console "true NUMBER" if the number is divisible without remainder by 7 and 5. Otherwise prints "false NUMBER". In place of NUMBER print the value of the input number.
using System;
class Program
{
static void Main()
{
Console.WriteLine("Entra un número entero: ");
int num;
num = Convert.ToInt16(Console.ReadLine());
if(num % 5 == 0 || num % 7 == 0){
Console.WriteLine("El número: " + num + " es divisble por 5 ó 7");
}else{
Console.WriteLine("El número: " + num + " NO es divisble por 5 ó 7");
}
}
}Saludos.
« Última modificación: 20 de Julio 2016, 12:31 por César Krall »

En línea