0% found this document useful (0 votes)
138 views29 pages

Mysirg A - Merged - Removed

्ससं सॆ ्रं्रिलन मंरकपिमल मलं हगगनलम

Uploaded by

missonmines
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views29 pages

Mysirg A - Merged - Removed

्ससं सॆ ्रं्रिलन मंरकपिमल मलं हगगनलम

Uploaded by

missonmines
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Https://premium.mysirg.com http://saurabhshuklaclasses.

com
C, C++ and DSA in Depth

Assignment-1: Input and output in C Language

Write a program to print Hello Students on the screen.


2. Write a program to print Hello in the first line and Students in the second line.
3 Write a program to print "MySirG" on the screen. (Remember to print in double
quotes)
Write a program to print In on the screen.
5. Write a program to int Ir on the screen.
6. Write a program to print "Teacher's Day" on the screen. (Remember to print
double and single quotes)
. Write a program to calculate sum of two integers. Numbers are taken from user
through keyboard.
8. Write a program to calculate square of a given number. Number is entered by the
user.
9. Write a program to calculate area of a rectangle. Input appropriate data from the
user.
10. WAP to find the area of the circle. Take radius of circle from user as input and print
the result in below given format.

Expected output format- "Area of circle is A having the radius R". Replace A with area &R
with radius.
Https://premium.mysirg.com http://saurabhshuklaclasses.com
C, C++ and DSA in Depth

Assignment-2: More on printf and scanf


1. Write a program to calculate average of three integers. Numbers are given by the
user.
2. Write a program to calculate circumference of a circle.
3. Write a program to calculate simple interest.
4. Write a program to calculate volume of a cuboid.
5. Write a program to ask user about the cost price and selling price banana per
dozen. Calculate the profit or loss earned upon selling 25 bananas.
6. Write a program to input a character from the user and print its ASCIl code.
7. Write a program to input an ASCII code from the user and print its correspondingg
character.
8. Write a program to input three characters from the user and display characters with
their corresponding ASCII codes.
9 WAP to take« ate as an inputi below given format d convert the date format
and display the result as given below.
User Input date format "DD/MMYYYY" (27/11/2022)
-

Output format- "Day- DD, Month MM, Year- YYYY" (Day


Year - 2022)
-

27 ,Month- 07

10. WAP to take time as an input in below given format and convert the time format and
display the result as given below.
User Input date format-"HH:MM"

Output format "HH hour and MM Minute"


Https://premium.mysirg.com http://saurabhshuklaclasses.com

C, C++ and DSA in Depth

Assignment-3: Operators in C Language

1. Write program to calculate size of a character constant.


2. Write a program to calculate size of a real constant.
3. Write a program with one char type variable. Assign A in the variable. Now change
the value of variable from 'A to 'B' using increment operator.
4. Write a program to print unit digit of a given number
5. Write a program to print a given number without its last digit.
6. Write a program to swap values of two int variables
. Write a program to swap values of two int variables without using a third variable.
variable and
8. Write a program to swap values of two int variables without using third
without using +, - o p e r a t o r s .
third variable and
9. Write a program to swap values of two int variables without using
arithmetic operators.
int variables in single line arithmetic
10. Write a program to swap values of two
expression.
Https://premium.mysirg.com http://saurabhshuklaclasses.com

C, C++ and DSA in Depth

Assignment-4: More on Operators in C Language


1. Write a program to input a three digit number and display the sum of the digits.
'+.
2. Write aprogram to find ASCII code of the character
3. Write a program to print size of an int, a float, a char and a double type variable
4. Write a program to make the last digit of a number stored in a variable as zero.
(Example if x=2345 then make it x=2340)
-

5. Write a program to input a number from the user and also input a digit. Append a
digitin the print the resulting number. (Example number=234 and
number and
then the resulting number is 2349)
digit=9
6. Assume price of 1 USD is INR 84.23. Write a program to take the amount in INR
and convert it into USD.
7. Write a program to take a three digit number from the user and rotate its digits by
one position towards the right.
8. What will be the value stored in the variable x after executing following statement:
x=10>8>4;
after executing following statement:
9. What will be the value stored in the variable x

x=!2>-2;
10. What will be the value stored in the variable x after executing following statement:
x=3<0&&5>0;
Https://premium.mysirg.com http://saurabhshuklaclasses.com

C, C++ and DSA in Depth

Assignment-5: Decision Control Statements

1. Write a program to check whether a given number is positive or non positive.


2. Write a program to check whether a given number is divisible by 5 or not
3. Write a program to check whether a given number is an even number or an odd
number.
4. Write a program to check whether a given number is an even number or an odd
number without using % operator.
5. Write a program to check whether the given number is even or odd using a bitwise
operator.
. Write a program to check whether a given number is a three digit number or not.
7. Write a program to print greater between two numbers. Print one number if both are
the same.
8. Write a program to check whether roots of a given quadratic equation are real &
distinct, real & equal or imaginary roots
9. Write a program to check whether a given year is a leap year or not.
10. Write a program to find the greatest among three given numbers. Print number
once if the greatest number appears two or three times.
Https://premium.mysirg.com http://saurabhshuklaclasses.com

C, C++ and DSA in Depth

Assignment-6: More on Decision Control Statements

1. Write a program to check whether a given number is a three digit number or not.
2. Write a program which takes the cost price and selling price of a product from the
user. Now calculate and print profit or loss percentage.
3. Write a program to take marks of 5 subjects from the user. Assume marks are given
Out of 100 and passing marks is 33. Now display whether the candidate passed the
examination or failed.
4. Write a program to check whether a given alphabet is in uppercase or lowercase.
5. Write a program to check whether a given number is divisible by 3 and divisible by
2.
6. Write a program to check whether a given number is divisible by 7 or divisible by 3.
7. Write a program to check whether a given number is positive, negative or zero.
8. Write a program to check whether a given character is an alphabet (uppercase), an
alphabet (lower case), a digit or a special character.
9. Write a program which takes the length of the sides of a triangle as an input.
Display whether the triangle is valid or not.
10. Write a program which takes the month number as an input and display number of
days in that month.
Https://premium.mysirg.com http://saurabhshuklaclasses.com

C, C++ and DSA in Depth

Assignment-7: Iterative Control Statements


1. Write a program to print MySirG 5 times on the screen
2. Write a program to print the first 10 natural numbers.
3. Write a program to print the first 10 natural numbers in reverse order
4 Write a program to print the first 10 odd natural numbers
5. Write a program to print the first 10 odd natural numbers in reverse order.
6. Write a program to print the first 10 even natural numbers
7. Write a program to print the first 10 even natural numbers in reverse order
8 Write a program to print squares of the first 10 natural numbers
9 Write a program to print cubes of the first 10 natural numbers
10. Write a program to print a table of 5.
Https://premium.mysirg.com http://saurabhshuklaclasses.com

C, C++ and DSA in Depth

Assignment-8: More on Iterative Control Statements

1. Write a program to print MySirG N times on the screen


2. Write a program to print the first N natural numbers.
3. Write a program to print the irst N natural numbers in reverse order
4. Write a program to print the first N odd natural numbers
5. Write a program to print the first N odd natural numbers in reverse order.
6. Write a program to print the first N even natural numbers
7. Write a program to print the first N even natural numbers in reverse order
8. Write a program to print squares of the first N natural numbers
9. Write a program to print cubes of the first N natural numbers
10. Write a program to print a table of N.
Https://premium.mysirg.com http://saurabhshuklaclasses.com
C, C++ and DSA in Depth

Assignment-9: Use any loop


Write a program to calculate sum of first N natural numbers
2. Write a program to calculate sum of first N even natural numbers
3. Write a program to calculate sum of first N odd natural numbers
4.
5.
Write a
Write a
program
program
to
to
calculate sum of squares of first N natural numbers
calculate sum of cubes of first N natural numbers
5.
Write
Write
a program to calculate factorial of a number
a program to count digits in a given number
8. Write a program to check whether a given number is a Prime number or not
9. Write a program to calculate LCM of two numbers
10. Write a program to reverse a given number
Https://premium.mysirg.com http://saurabhshuklaclasses.com

C, C++ and DSA in Depth

Assignment-10: Level up with loops

1. Write a program to find the Nth term of the Fibonacci series.


2 Write a program to print first N terms of Fibonacci series
3. Write a program to check whether a given number is there in the Fibonacci series or
not.
4. Write a program to calculate HCF of two numbers
5. Write a program to check whether two given numbers are co-prime numbers or not
5. Write a program to print all Prime numbers under 100
Write a program to print all Prime numbers between two given numbers
8. Write a program to find next Prime number of a given number
9. Write a program to check whether a given number is an Armstrong number or not
10. Write a program to print all Armstrong numbers under 1000
ups:premium.mnysirg.com nup//sauraonsnUKlaclaSSOS.Con

C, C++DSA in Depth
Assignment-11: Star Pattern Problems

Write a program to draw the following patterns:

21
23
2 34 3 2
2 3 4 S 43 2
AecDE ABCDE ** K

GCDE
ABCD
456 CDDE
ABC
A DE
A
Https://premium.mysirg.com http://saurabhshuklaclasses.com
C, C++DSA in Depth

Assignment-12: Star Pattern Problems

Write a program to draw the following patterns:

23 2
2 3 4 3 21

ABCDEFG ABCDcsA
ABCDE ABC BA
AC ABA 2
A A 2

)**** nuw 123432 ABCDCBA


23 32 A BC cBA
2 21 BA
A A
Htps://premium.mysirg.com http://saurabhshuklaclasses.com
c, Ct+ DSA in Depth

ASsignment-13: switch case control

1. Write a program which takes the month number as an input and display numberof

2.
days in that month.
Write a menu driven program with the following options.
Addition
2. Subtraction
Multiplication
DIVisIon
EXIt

3 Write a program which takes the day number of a week and displays a unique
greeting message for the day.
4. Write driven program with
1.
aCheck
menu whether the folowing options
a given set of three numbers are lengths of an isosceles

triangle or not
2. Check whether a given set of three numbers are lengths of sides of a right
angled triangle or not
3. ChecK Wnetner a given set or thfee numbers are equilateral tiangle or not
. Exit

5. Convert the following if-else-f construct into Switch


case
f(var 1)
printrgood");
else if(var
print"oetter")
else if(var 3
printf("best);
ese
printrf invalid");

6. Program to find and display grade obtained by a student in a test. Grading


specific ations are as follows
Marks from 90 to 100: GradeeA
Marks from 60 to less than 90 Grade B
Marks from 70 to less than 80: Grade C
Marks Trom 60 to less than 70:Grade D
Marks from 50 to less than 60: Grade E
Marks below 50 : Grade F
Marks greater than 100 or less than 0: Invalid Marks
. w i t e a menu ariven prOgram win tne Toliowing opuons.
1 Factorial of a number
2. Check Even and Odd
3. Area of circle
4. Sum of first N natural numbers
5. Exit
nttp:/saurabhshukiaclasses.com
Https://premium.mysirg.com
8 Write a program to check whether a given character uppercase alphabet
is or lOwer
swich c a s e
case alpnabet or some otner special cnaracter, using onsona
is Vowel or or some
9. Write a program to cheCK Wnether a given character
otner special character, using switch case starement
10. Write a menu drven program with the folowing opions
numbers
aic Uldre LCM OT Two
2. Calculate sum of the digirts of a numDer
Volume of a cubold
number is Prime or not
4 Check whether a given
.

You might also like