Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. static void Main(string[] args)
  2. {// Aquest programa realitza la multiplicacio dels nombres entrats per teclat sense fer servir el producte.
  3. int firstValue=-1, secondValue=-1, aux=0;
  4. while (firstValue <= 0 || secondValue <= 0)
  5. {
  6. Console.Write("ENTER THE FIRST POSITIVE VALUE: ");
  7. firstValue = Convert.ToInt32(Console.ReadLine());
  8. Console.Write("ENTER THE SECOND POSITIVE VALUE: ");
  9. secondValue = Convert.ToInt32(Console.ReadLine());
  10. }
  11. if (firstValue >= secondValue)
  12. {
  13. for (int i = secondValue; i > 0; i--)
  14. {
  15. aux = aux + firstValue;
  16. }
  17. Console.WriteLine("{0} x {1} = {2}", secondValue, firstValue, aux);
  18. }
  19. else
  20. {
  21. for (int i = firstValue; i > 0; i--)
  22. {
  23. aux = aux + secondValue;
  24. }
  25. Console.WriteLine("{0} x {1} = {2}", firstValue, secondValue, aux);
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement