![]() The following C# Program will allow the user to input a number and then it will print all the Happy numbers between 1 and that input number.Ĭonsole.WriteLine("Happy Numbers Between 1 and " + Number + " : ") Unhappy number ends in a cycle of repeating numbers which contains 4Ĭonsole.WriteLine(Number + " is not a happy number") Ĭ# Program to Print all Happy Numbers Between 1 and N Int Number = Convert.ToInt16(Console.ReadLine()) Ĭonsole.WriteLine(Number + " is a happy number") Calculates the sum of squares of digits IsHappyNumber() will determine whether a number is happy or not The following code shows how to implement the Happy Number program in C#. ![]() ![]() Repeat the steps from a to c till the sum of the square of all digits present in the number has been calculated.ģ) Define a variable result and initialize it with a value of num.Ĥ) If the result is neither equal to 1 nor 4 then, make a call to IsHappyNumber().ĥ) Otherwise, if the result is equal to 1 then, the given number is a happy number.Ħ) If the result is equal to 4 then, the given number is not a happy number.Calculate the square of rem and add it to a variable sum.If the number is greater than 0, then calculate remainder rem by dividing the number by 10.Here are the steps to follow: –ġ) IsHappyNumber() determines whether a given number is a happy number or not. If the resulting sum is equal to 1 then the given number is a happy number. The idea is very simple, calculate the square of each digit present in the number and add it to a variable sum. How to Remove Duplicate Elements from an Array in C#Ģ) Divides /: Divides numerator by de-numeratorĦ8/ 10 = 6 Algorithm to Implement Happy Number:.How to find the angle between hour and minute hands of a clock at any given time in C#.How to Perform Right Circular Rotation of an Array in C#.How to Perform Left Circular Rotation of an Array in C#.How to convert a one-dimensional array to a two-dimensional array in C#.How to convert a two-dimensional array to one-dimensional array in C#. How to Find All Substrings of a Given String in C#.How to Remove Duplicate Characters From a String in C#.Reverse Each Word in a Given String in C#.Data Structures and Algorithms Tutorials.Meanwhile, a significant number of other companies have also laid off a substantial amount of workers this year, with almost 1.5 lakh individuals being affected to date. This comes after they had previously fired 18,000 employees. At least 1.6 lakh workers lost their jobs in 2022, and the year 2023 has begun on a similar note.Īlso Read: Amazon announces fresh round of layoffs, to cut 9,000 jobs in coming weeksĪmazon has contributed to the worsening outlook for the technology industry by terminating an additional 9,000 employees. The year 2022 was challenging for the technology industry and startups. On the global front, 503 tech companies have laid off 148,165 employees so far this year. The layoff came in three phases 1,000 in April, 150 in June and 350 in November. Unacademy has laid off 1,500 employees so far, all of it came in 2022. In September 2022, it asked 200 people to leave and terminated 200 employees again in January 2023. In May 2020, it laid off 1,400 employees while it sacked 1,000 people in July 2022. Ola has laid off its employees four times since May 2020.
0 Comments
Leave a Reply. |