Advertisement
royroy23

HomeWork

Jan 14th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication17
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. //3
  14. int a, b, num1, num2;
  15. for (a = 1; a <= 50; a++)
  16. {
  17. Console.WriteLine("Please enter 2 numbers:");
  18. num1 = int.Parse(Console.ReadLine());
  19. num2 = int.Parse(Console.ReadLine());
  20. if (num1 < num2)
  21. {
  22. for (b = num1; b <= num2; b++ )
  23. Console.Write(b + " ");
  24. }
  25. if (num1 > num2)
  26. {
  27. for (b = num2; b <= num1; b++)
  28. Console.Write(b + " ");
  29. }
  30. Console.WriteLine();
  31. }
  32.  
  33. // 4
  34. int hrs, i, totalhrs, k;
  35. double hrpay, payment, avg, sumpay = 0;
  36. for (i = 1; i <= 500; i++)
  37. {
  38. totalhrs = 0;
  39. Console.WriteLine("Employee No. " + i + ":");
  40. for (k = 1; k <= 25; k++)
  41. {
  42. if (k > 2)
  43. Console.WriteLine("How many hours did you work on the " + k + " day?");
  44. else if (k == 2)
  45. Console.WriteLine("How many hours did you work on the second day?");
  46. else if (k == 1)
  47. Console.WriteLine("How many hours did you work on the first day?");
  48. hrs = int.Parse(Console.ReadLine());
  49. totalhrs += hrs;
  50. }
  51. Console.WriteLine("How much money do you get for a single hour?");
  52. hrpay = int.Parse(Console.ReadLine());
  53. payment = hrpay * totalhrs;
  54. Console.WriteLine("Worker ID " + i + " got " + payment + "$ this mounth.");
  55. sumpay += payment;
  56. }
  57. avg = sumpay / 500;
  58. Console.WriteLine("The average payment was: " + avg + "$.");
  59.  
  60. //5
  61. int i, k, j;
  62. for (i = 1; i <= 10; i++)
  63. {
  64. for (k = 1; k <= 10; k++)
  65. {
  66. j = i * k;
  67. if (j < 10)
  68. Console.Write(j + " ");
  69. else
  70. Console.Write(j + " ");
  71. }
  72. Console.WriteLine();
  73. }
  74.  
  75. //6
  76. int a, b;
  77. for (a = 1; a <= 6; a++)
  78. {
  79. for (b = 1; b <= 6; b++)
  80. {
  81. Console.Write("(" + a + "," + b + ") " );
  82. }
  83. Console.WriteLine();
  84. }
  85. }
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement