Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*make 20 zogot numbers and print the average for every 2 numbers*/
- //int number1;
- //int number2;
- //double AVG;
- //Random rnd = new Random();
- //for (int i = 0; i <= 20; i++)
- //{
- // number1 = rnd.Next(1, 11);
- // number2 = rnd.Next(1, 11);
- // AVG =(double) (number1 + number2) / 2;
- // Console.WriteLine("number1: " +number1 + " number2 " + number2 + " the avg is: " + (double)AVG );
- //}
- /******************************************************/
- /*make 20 zogot numbers and print the average for every 2 numbers*/
- //double num1, num2, AVG;
- //int count = 0;
- //Random rnd = new Random();
- //while(count < 20)
- //{
- // // Create 2 Random numbers
- // num1 = rnd.Next(1, 20);
- // num2 = rnd.Next(1, 20);
- // // create avg to average 2 numbers
- // AVG = (double)(num1 + num2) / 2;
- // // print the two number and the avergae
- // Console.WriteLine("number1: " + num1 + " number2: " + num2 + " Average is " + AVG);
- // //add 1 count for counter
- // count++;
- //}
- /*take a many charecters from user and count how much capital letter writted*/
- //char charecter;
- //int listSize = 10;
- //char capitalLetter;
- //int counter = 0;
- //for (int i = 1; i <= listSize; i++)
- //{
- // // take a char from the user
- // Console.WriteLine("Enter Char");
- // // capitalLetter = what user write
- // capitalLetter = Console.ReadKey().KeyChar;
- // // check if the letter is capital
- // if(capitalLetter >= 65 && capitalLetter < 91)
- // {
- // // add 1 to the counter when the letter is capital
- // counter++;
- // // print the capital number and and number of capitalLetters
- // Console.WriteLine(capitalLetter + " is capitalLetter" + "number of capitalLetter is: " + counter);
- // }
- //}
- /*********************************************************************/
- /*1/1 + 1/2 ....... 1/n sum the number when write n*/
- //double a = 1, b = 1;
- //double n = double.Parse(Console.ReadLine());
- //double sum;
- //double sumAfter = 0;
- //for (double i = 1; i <= n; i++)
- //{
- // sum = (double)(a / i);
- // sumAfter = (double)sumAfter + sum;
- //}
- //Console.WriteLine((double)sumAfter);
- // /*Write 1 2 3 4 5 6 7 8 9 10
- /*2 4 6 8 10 12 14 16 18 20
- /*3 6 9 12 15 18 21 24 27 30 */
- //for (int i = 1; i <= 10; i++)
- //{
- // for (int j = 1; j <= 10; j++)
- // {
- // Console.Write(" \t" + i * j);
- // }
- // Console.WriteLine();
- //}
- /******************************************/
- Random rnd = new Random();
- int number;
- int sum = 0;
- for (int i = 0; i <= 10; i++)
- {
- number = rnd.Next(1, 11);
- if(number == 5)
- {
- Console.WriteLine("The random number is 5");
- break;
- }
- sum = sum + number;
- Console.Write(number + " ");
- }
- Console.WriteLine("sum is: " + sum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement