Day 1 - Week 1
A classroom is arranged in a grid format with row
rows and col
columns.
- The first and last columns are for CSE students.
- The middle columns are for ECE students.
Input: Number of rows, columns, and a seat number.
Output: The department (CSE or ECE) to which the seat belongs.
Day 1 - Week 1
Write a simple Java program (e.g, Hello World or basic input/output).
Day 1 - Week 1
Given a 4-digit number, extract the first and last digits and print their sum.
Day 2 - Week 1
Write a program to reverse a given three-digit number.
Day 2 - Week 1
Input:
- Total gold treasure
- Ben’s share percentage
- Blackbeard’s share percentage
Output:
- Ben’s share amount
- Blackbeard’s share amount
- Remaining gold is to be equally divided among 3 other pirates.
Day 2 - Week 1
Take a 2-digit number as input.
- If it is less than 20, print
"Less than 20"
- If it is greater than or equal to 20, print whether it is odd or **even`
Day 2 - Week 1
Input: An integer n
Output:
- If
n
is not a 3-digit number →"Invalid Number"
- If the middle digit of the 3-digit number is divisible by 3 →
"Trendy Number"
- Else →
"Not Trendy Number"
Day 2 - Week 1
Calculate hotel tariff with 20% increase during the season (April–June and November–December).
Input:
- Month number (1–12)
- Rent per day
- Number of days
Output:
- Print the total tariff
- If the month is invalid, print
"Invalid Input"
Day 2 - Week 1
Input: An integer n
Rules:
- If
n
is odd, print"Weird"
- If
n
is even and in the range [2, 5], print"Not Weird"
- If
n
is even and in the range [6, 20], print"Weird"
- If
n
is even and greater than 20, print"Not Weird"
Day 2 - Week 1
Print all odd numbers from 1 to 9 using a while
loop.
Day 2 - Week 1
Print numbers from 0 to 9 using a do-while
loop.
Day 3 - Week 1
Given an integer, calculate:
- Sum of even digits
- Sum of odd digits
- Total number of digits
Day 3 - Week 1
Count how many numbers between 1 and 110 consist of only odd digits.
Day 3 - Week 1
Function Signature:
int NearestInteger(int num, int m);
Requirements:
- Return the number divisible by
m
and closest tonum
. - If two numbers are equally close, return the larger one.
Example:
Input: 67
, m = 8
→ Output: 64
Day 3 - Week 1
Given two numbers, print the number nearest to the first number that is divisible by the second number.
Day 3 - Week 1
Write a program to repeatedly sum the digits of a number until the result is a single digit.
Day 4 - Week 1
A number is a Harshad Number if it is divisible by the sum of its digits.
Day 4 - Week 1
A number is an Adam Number if the square of the number, when reversed, equals the square of the reverse of the number.
Example:
- Input:
12
- Square(12) =
144
- Reverse(Square) =
441
- Reverse(12) =
21
→ Square =441
Day 4 - Week 1
An Armstrong number is a number where the sum of the digits raised to the power of number of digits is equal to the number itself.
Example: 153 → 1^3 + 5^3 + 3^3 = 153
Day 4 - Week 1
A number is a Kaprekar Number if:
k^2
is split into two parts that sum tok
.
Examples:9 → 81 → 8 + 1 = 9
297 → 88209 → 88 + 209 = 297
Day 4 - Week 1
A number is a Strong Number if the sum of the factorials of its digits equals the number.
Examples:
145 → 1! + 4! + 5! = 145
40585 → 4! + 0! + 5! + 8! + 5! = 40585
Week 1 - Day 4
Take input a number from the user and print the Right-Angled Triangle Pattern.
Week 1 - Day 4
Take input a number from the user and print the Inverted Right-Angled Triangle Pattern.
Week 1 - Day 5
Print the Left-Aligned Staircase Pattern based on the input number of rows.
Week 1 - Day 5
Print the Right-Aligned Reverse Staircase Pattern based on the input number of rows.
Week 1 - Day 5
Print a Square Pattern with Star Border and Empty Center.
// Program 27 // Week 1 - Day 5 // Print Traingle Pattern center empty
// Program 28 // Week 1 - Day 5 // Print first four alphabate of name in pattern by using *
// Program 29 // Week 1 - Day 5 // Arrays // Sum of all the elements in the array
// Program 30 // Week 1 - Day 5 // Subtract of all the elements in the array // imput: 1-2-3-4-5 // Output: -13
// Program 31 // Week 1 - Day 5 // Note: Two arrays are said to be the same if the sum of both arrays os the same and the size of the array is the same // Input: Input consist of 2 integers and 2 array. The integer should corrospend to the size of the array
// Output: //4 //4 //1 //2 //3 //4 //1 //2 //3 //4
// Program 32 // Week 1 - Day 6 // Input consists of 2n + 2 integers. The first integer correspond to n1. the size of arrat. The next n1 integre correspond to the elements in the first array. The next (n + 1) integer corresponds to n2. the size of the second array. The last n2 integers correspond to the elements in the second array. // Output : Compatible array or incompatible array
// Program 33 // Week 1 - Day 6 // Array insertion by not removing any existing elements.
// Program 34 // Week 1 - Day 6 // Write a program to remove all the duplicate elements from an array.
// Program 35 // Week 1 - Day 6 // Cubic Sum: Given function: //Int isCubicSumExist(long long int A[], int N); // The function accept an array A of size N and returns 1 if there exists a pair of elements in the array such that their sum is a perfect cube. Otherwise, it returns 0. // Input: N:3, A:[35,9,1] // Output: 2 // Explanation: 35 is a good integre, there exist an answer with X = 2, y = 3(23 + 33 = 8 + 27 = 35)