public class FizzBuzz { public string GetOutput(int number) { for (int i = 1; i <= 100; i++) { string str = ""; if (i % 3 == 0) { str += "Fizz"; } if (i % 5 == 0) { str += "Buzz"; } if (str.Length == 0) { str = i.ToString(); } Console.WriteLine(str); } return "0"; } }
- public class FizzBuzz
- {
- public string GetOutput(int number) {
// Fizz buzz is a popular computer science interview question.// The function above is given a number - if the number is// divisible by 3, return "fizz", if it's divisible by 5,// return "buzz", if not divisble by 3 or 5 - return the// number itself.- for (int i = 1; i <= 100; i++)
- {
- string str = "";
- if (i % 3 == 0)
- {
- str += "Fizz";
- }
- if (i % 5 == 0)
- {
- str += "Buzz";
- }
- if (str.Length == 0)
- {
- str = i.ToString();
- }
- Console.WriteLine(str);
- }
- return "0";
- }
- }
function find_unique_items(array1, array2) { var array1 = [ 1, 2, 3, 4, 5, 6, 7, 8]; var array2 = [ 3, 5, 7 ]; var difference = array1.filter(x => array2.indexOf(x) === -1); console.log(difference); return [1,2,4,6,8] var array1 = [ 1, 2, 3, 4, 5, 6, 7, 8]; var array2 = [ 2,5 ]; var difference = array1.filter(x => array2.indexOf(x) === -1); console.log(difference); return [1,3,4,6,7,8] }
- function find_unique_items(array1, array2)
- {
var first = [ 1, 2, 3, 4, 5, 6, 7, 8];var second = [ 3, 5, 7 ];var difference = first.filter(x => second.indexOf(x) === -1);- var array1 = [ 1, 2, 3, 4, 5, 6, 7, 8];
- var array2 = [ 3, 5, 7 ];
- var difference = array1.filter(x => array2.indexOf(x) === -1);
- console.log(difference);
- return [1,2,4,6,8]
var first = [ 1, 2, 3, 4, 5, 6, 7, 8];var second = [ 2,5 ];var difference = first.filter(x => second.indexOf(x) === -1);- var array1 = [ 1, 2, 3, 4, 5, 6, 7, 8];
- var array2 = [ 2,5 ];
- var difference = array1.filter(x => array2.indexOf(x) === -1);
- console.log(difference);
- return [1,3,4,6,7,8]
- }
function find_unique_items(array1, array2) { var first = [ 1, 2, 3, 4, 5, 6, 7, 8]; var second = [ 3, 5, 7 ]; var difference = first.filter(x => second.indexOf(x) === -1); console.log(difference); return [1,2,4,6,8] var first = [ 1, 2, 3, 4, 5, 6, 7, 8]; var second = [ 2,5 ]; var difference = first.filter(x => second.indexOf(x) === -1); console.log(difference); return [1,3,4,6,7,8] }
- function find_unique_items(array1, array2)
{//Find the unique elements from two arrays- {
- var first = [ 1, 2, 3, 4, 5, 6, 7, 8];
- var second = [ 3, 5, 7 ];
- var difference = first.filter(x => second.indexOf(x) === -1);
- console.log(difference);
- return [1,2,4,6,8]
- var first = [ 1, 2, 3, 4, 5, 6, 7, 8];
- var second = [ 2,5 ];
- var difference = first.filter(x => second.indexOf(x) === -1);
- console.log(difference);
- return [1,3,4,6,7,8]
- }
dk m
interface HighLow { static int[] findLargestAndSmallest(int[] nums) { // Change min and max below to be the highest and lowest values // in the nums array provided to the function int min = 0; int max = 100; for(int i; i< findLargestAndSmallest; i++) { min = nums[0]; if(nums[i] < min) min = nums[i]; } for(int i; i< findLargestAndSmallest; i++) { max = nums[0]; if(nums[i] > max) max = nums[i]; } return new int[]{min, max}; } }
- interface HighLow {
- static int[] findLargestAndSmallest(int[] nums) {
- // Change min and max below to be the highest and lowest values
- // in the nums array provided to the function
- int min = 0;
- int max = 100;
- for(int i; i< findLargestAndSmallest; i++)
- {
- min = nums[0];
- if(nums[i] < min)
- min = nums[i];
- }
- for(int i; i< findLargestAndSmallest; i++)
- {
- max = nums[0];
- if(nums[i] > max)
- max = nums[i];
- }
- return new int[]{min, max};
- }
- }