Rupakk
Rupakk
WEEK-1
LAB: 01
5.WAP in C to find the size of int,float double and char variable.(Use %lu or %zu as well as
sizeof(variable) function.
6.WAP in C to calculate the average of two number given by the user.
LAB: 02
3. WAP in C to calculate area of rectangle from the user input length and breadth.
4.WAP in C to calculate area of circle for the user input radius. Take the value of pi a constant i.e
3.14.(const float pi=3.14)
3.Write a program to accept 2 numbers. Calculate the difference between the two values. If
the difference is equal to any of the values entered, then display the following message:
Difference is equal to value If the difference is not equal to any of the values entered,
display the following message: Difference is not equal to any of the values entered
4.Write a program to find whether a given year is a leap year or not.
LAB: 04
Course Outcomes:CSH102C.1: To demonstrate programming skills for solving elementary
problems.
Blooms Taxonomy Level: BT1, BT2,BT3
Learning Objective: Aim: Students will be able to handle to implement and analyze basic
concepts based on decision statements used in C programming language
1.Declare two variables x and y. Assign values to these variables. Number x should be
printed only if it is less than 2000 or greater than 3000, and number y should be printed only
if it is between 100 and 500.
2.Write a program to print the greatest of two numbers using conditional operators.
3.Write a program which displays the following output on the basis of inputted Mode Of
Payment and Tuition fees. Mode of payment can be 1, 2 or 3.
Mode Action
1 - Cash 10% Discount
2 - Two-Installment 5% Interest
3 - Three-Installment 10% Interest
Sample Outputs:
Enter Your Tuition Fee: 20000
Choose Mode of Payment: 1
The Amount of Payment: Rs. 18000
Enter Your Tuition Fee: 20000
Choose Mode of Payment: 2
The Amount of Payment: Two installments of Rs.10500 each
Enter Your Tuition Fee: 20000
Choose Mode of Payment: 3
The Amount of Payment: Three installments of Rs.7333.33 each
4.Write a program to accept the three sides of a triangle and determine whether they form a
valid triangle.
LAB: 05
Course Outcomes:CSH102C.1: To demonstrate programming skills for solving elementary
problems.
Blooms Taxonomy Level: BT1, BT2, BT3
Learning Objective: Students will be able to implement and analyze basic concepts based
on decision statements using nested-if else in C programming language.
1. Using nested if else statements, write a C program to find the largest of three numbers.
2. Triangle Type Determination
Question: Write a C program that takes the lengths of three sides of a triangle as input and
determines if the triangle is:
⦁ Equilateral (all sides equal)
⦁ Isosceles (two sides equal)
⦁ Scalene (all sides different)
⦁ Not a triangle (if the sum of any two sides is not greater than the third side)
3. Simple Calculator
Question: Write a C program that simulates a simple calculator. The program should take
two integers and a character (+, -, *, /, %) as input and output the result of the operation. If
the operator is invalid, print an error message.
4. Discount Based on Membership and Purchase Amount
Question: A store gives discounts based on membership status and the amount spent.
Members spending over Rs.100 get a 10% discount, non-members spending over Rs.150
get a 5% discount, and all others get no discount.
1. Vowel or Consonant
Question: Write a C program that takes a single character as input and uses a switch
statement to determine if the character is a vowel (a, e, i, o, u) or a consonant. Handle both
uppercase and lowercase letters.
4. Grade Classification
Question: Write a C program that takes an integer input representing a student's score and
prints the corresponding grade based on the following scale:
⦁ 90-100: A
⦁ 80-89: B
⦁ 70-79: C
⦁ 60-69: D
⦁ 0-59: F
5. Temperature Rating
Question: Write a C program that takes a temperature in Celsius and provides a description
based on the temperature:
⦁ Below 0°C: Freezing
⦁ 0°C to 10°C: Cold
⦁ 11°C to 20°C: Cool
⦁ 21°C to 30°C: Warm
⦁ Above 30°C: Hot
LAB: 07
Course Outcomes:CSH102C.1: To demonstrate programming skills for solving elementary
problems.
Blooms Taxonomy Level: BT1, BT2, BT3
Learning Objective: Students will be able to handle to implement and analyze basic
concepts based on decision statements using while loopin C programming language
1. Write a C program that calculates the sum of all natural numbers up to a given number n
using a while loop. The program should take an integer input n and print the sum
2.Write a C program that calculates the factorial of a given non-negative integer n using a
while loop. The program should take an integer input n and print the factorial.
3.Write a C program that prints the Fibonacci series up to a given number n using a while
loop. The program should take an integer input n and print the Fibonacci series up to n.
4. Write a C program that prints the first n multiples of a given number k using a while loop.
The program should take integer inputs n (number of multiples) and k (the number to be
multiplied) and print the multiples.
5. Write a C program to print all alphabets from a to z. - using while loop.
LAB: 08
Course Outcomes:CSH102C.1: To demonstrate programming skills for solving elementary
problems.
Blooms Taxonomy Level: BT2,BT3
Learning Objective: Aim: Students will be able to handle to implement and analyze basic
concepts based on decision statements using while loop in C programming language.
1.Write a C program that counts the number of digits in a given integer using a while loop.
The program should take an integer input and print the count of its digits
2. Write a C program that reverses the digits of a given integer using a while loop. The
program should take an integer input and print the reversed number.
Lab-9
Q1. Write a C program to print numbers from 1 to 10 and 10 to 1 using a do-while loop.
Q2. Write a C program that prompts the user to input a series of integers until the user stops by
entering 0 using a do-while loop. Calculate and print the sum of all positive integers entered.
Q3. Write a C program that calculates the sum of even and odd numbers from 1 to 50 using do-while
loops
Q4. Write a C program that prompts the user to enter a series of numbers until they input a negative
number. Calculate and print the sum of all entered numbers using a do-while loop
LAB-10
Q1. Write a C program to compute the sum of the first 10 natural numbers
Q2. Write a program in C to read 10 numbers from the keyboard and find their sum and
average.
Q3. Write a program in C to display the cube of the number up to an integer.
Q4. Write a program in C to display the multiplication table for a given integer.
LAB-11
Q1. Write a program to make pattern like below:
Q2.write a program to make the Right Half Pyramid Pattern like below:
LAB-13
1. Write a program in C to find the reverse of a number using a function.
2. Write a program in C to check if a number input by the user is an Armstrong number
using a function.
3. Write a program in C to find the power of a number using a function (do not use the
inbuilt function pow ())
4. Write a program in C to read and display the elements of an array using a function.
5. Write a program in C to get the largest element of an array using a function.
LAB: 14
1. Write a program in C to count the number of digits in a given number using recursion.
2. Write a program in C to find the power of a number without using recursion.
2. Write a program in C to read n number of values in an array and display the array
in the reverse order.
LAB-17
Q1. Write a C code to swap two numbers using call by reference.
Q4. Write a program in C to access the elements of array without using its index
LAB-18
Q1. Program to calculate the length of a string without using built-in functions.
Q2. Program to copy one string to another without using strcpy().
Q8. Program to search for a substring within a string and return its position.