Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {// Aquest programa realitza la multiplicacio dels nombres entrats per teclat sense fer servir el producte.
- int firstValue=-1, secondValue=-1, aux=0;
- while (firstValue <= 0 || secondValue <= 0)
- {
- Console.Write("ENTER THE FIRST POSITIVE VALUE: ");
- firstValue = Convert.ToInt32(Console.ReadLine());
- Console.Write("ENTER THE SECOND POSITIVE VALUE: ");
- secondValue = Convert.ToInt32(Console.ReadLine());
- }
- if (firstValue >= secondValue)
- {
- for (int i = secondValue; i > 0; i--)
- {
- aux = aux + firstValue;
- }
- Console.WriteLine("{0} x {1} = {2}", secondValue, firstValue, aux);
- }
- else
- {
- for (int i = firstValue; i > 0; i--)
- {
- aux = aux + secondValue;
- }
- Console.WriteLine("{0} x {1} = {2}", firstValue, secondValue, aux);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement