- Print Numbers: Write a program to print numbers from 1 to 10 using a for loop. ✅
- Even Numbers: Print even numbers between 1 and 20 using a for loop. ✅
- Odd Numbers: Print odd numbers between 1 and 20 using a while loop. ✅
- Sum of Numbers: Calculate the sum of numbers from 1 to 100 using a for loop. ✅
- Factorial: Calculate the factorial of a number using a while loop. ✅
- Fibonacci Series: Generate Fibonacci series up to n terms using a for loop. ✅
- Reverse Number: Reverse a given number using a while loop.
- Palindrome Number: Check if a given number is a palindrome using a while loop.
- Prime Numbers: Print prime numbers up to n using nested for loops.
- Armstrong Number: Check if a number is an Armstrong number using a for loop.
- Sum of Digits: Calculate the sum of digits of a number using a while loop. ✅
- Copy Array: Copy the elements of one array into another array. ✅
- Sum of Array Elements: Write a program to calculate the sum of all elements in an array. ✅
- Average of Array Elements: Calculate the average of elements in an array. ✅
- Largest Element in Array: Find the largest element in an array. ✅
- Smallest Element in Array: Find the smallest element in an array. ✅
- Search Element in Array: Search for a specific element in an array and print its index if found. ✅
- Reverse Array: Reverse the elements of an array. ✅
- Duplicate Elements in Array: Print the Duplicate elements of an array. ✅
- Sort Duplicate Elements: Remove Duplicate Element in an array. ✅
- Sorting in Ascending Order: Sort the elements of an array in Ascending order. ✅
- Sorting in Descending Order: Sort the elements of an array in Descending order. ✅
- Total Elements in Array: Print the number of elements in an array. ✅
- Odd Even Elements: Print Odd and Even Numbers from an array. ✅
- Left Rotate Elements in Array: Java Program to the left rotate the elements of an array. ✅
- Right Rotate Elements in Array: Java Program to right rotate the elements of an array. ✅
- Shift Index Ascending: Java Program to Sort the elements of an array in Ascending order from a specific Index. ✅
- Shift Index Descending: Java Program to Sort the elements of an array in Descending order from a specific Index. ✅
- User Defined Array: Java Program to create a user Defined Array. ✅
- Total Length and Present Element: Java Program to Insert Elements in an Array and Print its Elements and Length. ✅
- Add Element at First Index: Program to add Element at First Index of an Array. ✅
- Add Element at Last Index: Program to add Element at Last Index of an Array. ✅
- Add Element at given Index: Program to add Element at a given Index of an Array. ✅
- Addition of Array: To Add two Dimensional array.
- Subtraction of Array: To Subtract two Dimensional array.
- Multiplication of Array: To Multiply two Dimensional array.
- Division of Array: To Divide two Dimensional array.
- Count Total Character: Program to Calculate the Total Number of Characters in a String. ✅
- Count Punctuation: Java Program to count the total number of punctuation characters exists in a String. ✅
- Count Vowels and Consonants: Java Program to count the total number of vowels and consonants in a String. ✅
- Anagram of Strings: Java Program to determine whether two strings are the anagram. ✅
- Replace Spaces to Characters: Java Program to replace the spaces of a string with a specific character. ✅
- Reverse of String: Java Program to find Reverse of the string. ✅
-
FIZZBUZZ PROBLEM ✅
Given a number n, for each integer i in the range
from i to n inclusive, print one value per line as
follows:
• If i is a multiple of both 3 and 5, print FizzBuzz.
• If i is a multiple of 3(but not 5), print Fizz.
• If i is a multiple of 5(but not 3), print Buzz.
• If i is not a multiple of 3 or 5, print the value of i.
Function Description:
Complete the function fizzBuzz in the editor below.fizzBuzz has the following parameter(s):
int n: upper limit of values to test (inclusive)
Returns: NONE
Prints:
The function must print the appropriate response for each value i in the set {1, 2, ... n} in
ascending order, each on a separate line.Constraints:
• 0 < n < 2x105
Explanation:
The numbers 3, 6, 9, and 12 are multiples of 3(but not 5), so print Fizz on those lines. The numbers 5 and 10 are multiples of 5(but not 3), so print Buzz on those lines. The number 15 is a multiple of both 3 and 5, so print FizzBuzz on that line. None of the other values is a multiple of either 3 or 5, so print the value of i on those lines. -
LECTURE Question ✅
A new Chemistry teacher is very strict and wants
the students to do well in class. To aid this, lectures
on each chapter will be repeated periodically
through the semester. In each class, the next
chapter is presented. When they reach the end of
the book, the lectures start over with chapter 0.
More formally, if there are numChapters in the
book, then on the day, the lecture will be on
chapter i%numChapters. The first day of class is
class[0], and the first chapter is chapter 0. If there
are 3 chapters, daily lectures are on chapters class
= [0, 1, 2, 0, 1, 2, ...1. At class[4], the lecture will be
on chapter 4%3 = 1.
One of the students is going to be out of class for a
wedding, and the teacher is concerned about
missed lectures. Given the first and last days the
student will be out, determine the number of
chapters for which the student will miss lectures.
For example, there are numChapters = 4 chapters
in the book. The student is out of class beginning
on day b =3through ending day e = 5. The series
of lectures are on chapters class = [0, 1, 2, 3, 0, 1, 2, 3,..]
starting from day 0. For class[3] through
class[5], lectures are given on chapters 3, O and 1.
The student will miss lectures on 3 chapters.
Function Description:
Complete the function missedLectures in the editor below. The function must return an integer.- missedLectures has the following parameters:
- numChapters: an integer
- b: an integer
- e: an integer
Constrains
- 1 <= numChapters <= 109
- 1 <= b <= e <= 109
Sample Input For Custom Testing
5
5
6
Sample Output
2
Explanation
Chapters are taught in the order class = [0, 1, 2, 3, 4, 0, 1, 2, 3, 4] The student will miss chapters 0 and 1 on days 5 and 6 respectively. - missedLectures has the following parameters: