## Problem statement:

What is LCM of numbers
LCM is a least common factor of given two numbers

Given: input1 = 4 and input2 = 5
then answer is LCM = 20

### Write a C program to find LCM of numbers

Output

Help others by sharing the content!

## program to perform arithmetic operations using switch case statement

Problem statement:

Write a C program to take two numbers and operator as input then perform arithmatic operation depending on input operator.

### Write a C program to perform arithmetic operations on two numbers using switch case

Output

Help others by sharing the content!

## Problem statement

Write a program to reverse a number using loop.
input1 = 1234

Output

## Problem statement

Write a program to take 4 digit any number as input from the user and reverse that number but only using operators(or without using any function)

### Write a C program to reverse 4 digit number only with help of operators or without using function/loop

Output

Explanation

Help others by sharing the content!

## C Program to Sort Words in Lexicographical Order (Dictionary Order)

### Problem statement

Write a program to take words or elements as input from user and sort it as Lexicographical/Dictionary order.

### What is meant by Lexicographical Order:

Lexicographical Order is also known as lexical order, dictionary order, alphabetical order, lexicographic order.
Lexicographic order is the way of ordering of words based on the alphabetical order of their component letters.
It is similar to the way in we search any word in the dictionary.

Example:
Suppose following numbers: Ram, Rita, Abhinav, Abhish, Rina, Josh.
Now Lexicographical Order is- Abhinav, Abhish, Josh, Ram, Rina, Rita.

### Program to Sort Strings in Lexicographical/Dictionary Order

Output:

Help others by sharing the content!

## Program to find maximum difference between two elements such that larger element appears after the smaller number

Problem statement
Maximum difference between two elements such that larger element appears after the smaller number

Explanation:
Given an array arr[] of integers, find out the difference between any two elements such that larger element appears after the smaller number in arr[].

Examples:

• If array is [2, 3, 10, 6, 4, 8, 1] then returned value should be 8 (Diff between 10 and 2).
• If array is [ 7, 9, 5, 6, 3, 2 ] then returned value should be 2 (Diff between 7 and 9)

Conclusion:
You have to take first number of array and check it with remaining array elements.
Then find the largest number in remaining array (excluding number at array index 0).
Then find the difference between largest number from remaining array and first number from array.
This will be the largest difference between two elements.

### C program to find maximum difference between two elements such that larger element appears after the smaller number

Output:

Help others by sharing the content!

## C program to print a pattern

Pattern Problem – 5

You need to take an integer input and then draw the pattern according to it. Say for example if you enter 5 then, the pattern should be like this-

Input Format
You will take an integer input n from stdin.

Constraints
1 <= n <= 1000 Output Format
Your output should be the pattern according to the input which you had entered.

Sample TestCase 1
Input
5
Output:

### Write a C program to print the following pattern 5 5 5 5 5 4 4 4 4 4 3 3 3 3 3 2 2 2 2 2 1 1 1 1 1 12345 5 5 5 5 54 4 4 4 43 3 3 3 32 2 2 2 21 1 1 1 1

Output:

Help others by sharing the content!

## C program to print below program – Pattern problem 4

You need to take an integer input and then draw the pattern according to it.
Say for example if you enter 6 then, the pattern should be like this-

Input Format
You will take an integer input n from stdin.

Constraints
1 <= n <= 1000

Output Format
Your output should be the pattern according to the input which you had entered.

Sample TestCase 1
Input
5
Output:

### Write a C program to print following pattern A B C D E A B C D E A B C D E A B C D E A B C D E 12345 A B C D EA B C D EA B C D EA B C D EA B C D E

Output

Help others by sharing the content!

## C program to draw a pattern

You need to take an integer input and then draw the pattern according to it.
Say for example if you enter 5 then, the pattern should be like this-
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5

Input Format
You will take an integer input n from stdin.

Constraints
1 < = n < = 1000 Output Format
Your output should be the pattern according to the input which you had entered.

Sample TestCase 1
Input
5
Output

### Write a C program to print following pattern 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 12345 1 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 5

Program:

Output:

Help others by sharing the content!

## C program to print below program – Pattern problem 2

You need to take an integer input and then draw the pattern according to it.
Say for example if you enter 6 then, the pattern should be like this-

Input Format
You will take an integer input n from stdin.

Constraints
1 <= n <= 1000

Output Format
Your output should be the pattern according to the input which you had entered.

Sample TestCase 1
Input
6
Output:

### Program to print * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 123456 * * * * ** * * * ** * * * ** * * * ** * * * ** * * * *

Output

Help others by sharing the content!

## C program to find simple and compound interest

### Problem statement

Write a program to calculate simple interest and compound interest.
Here we will take principle, time and rate of as input from user.

## What is compound interest

The concept of compound interest is that interest is added back to the principal sum so that interest is earned on that added interest during the next compounding period.

#### The formula for calculating compound interest is:

= [P (1 + i)n] – P
= P [(1 + i)n – 1]

Where
P = Principal,
i = annual interest rate in percentage terms,
n = number of compounding periods.

## What is simple interest

Simple interest is a quick method of calculating the interest charge on a loan. Simple interest is determined by multiplying the daily interest rate by the principal by the number of days that elapse between payments.

#### The formula for calculating compound interest is:

Simple Interest = Interest Rate x Principal Balance

### What is Principle

Principal is the money used to pay down the balance of the loan.
The principal is the amount you are borrowing, and the interest is the charge for the time you have the loan.

### What is Interest

Interest is the charge paid to the lender for the privilege of borrowing the money.
Interest is calculated on the principal.

### Program to calculate the interest

Output:

Help others by sharing the content!