clab

4
K L University Course : Problem Solving Through Programming Sem-II, A.Y: 2014-2015 List of Experiments Topic Lab Number Experiment Name Introduction 1 Write a program to find simple interest when principle amount, rate of interest & no. of years are given. Write a program to find area of a rectangle. Rectangle having length l and breadth b. Write a Program to convert temperature from degree centigrade to Fahrenheit and vice versa. 2 For certain electrical circuit with an inductance L and resistance R and the capacitance C the damped natural frequency is given by Develop a program to calculate the frequency for the given values of L,R,C In inventory management, the economic order quantity for single item is given by and the optimal time between orders Develop a Program to compute EOQ and TBO, given demand rate( items per unit time), setup costs(per order) , and the holding cost ( per item per unit time) Conditional statements 3 Write a program to find the biggest of three numbers Write a program to check whether a given year is a leap year.

Upload: ponmalar-sivaraj

Post on 28-Sep-2015

222 views

Category:

Documents


0 download

DESCRIPTION

lab

TRANSCRIPT

  • K L University

    Course : Problem Solving Through Programming

    Sem-II, A.Y: 2014-2015

    List of Experiments

    Topic Lab

    Number Experiment Name

    Introduction

    1

    Write a program to find simple interest when principle

    amount, rate of interest & no. of years are given.

    Write a program to find area of a rectangle. Rectangle having

    length l and breadth b.

    Write a Program to convert temperature from degree

    centigrade to Fahrenheit and vice versa.

    2

    For certain electrical circuit with an inductance L and

    resistance R and the capacitance C the damped natural

    frequency is given by

    Develop a program to calculate the frequency for the given

    values of L,R,C

    In inventory management, the economic order quantity for

    single item is given by

    and the optimal time between orders

    Develop a Program to compute EOQ and TBO, given demand

    rate( items per unit time), setup costs(per order) , and the

    holding cost ( per item per unit time)

    Conditional

    statements 3

    Write a program to find the biggest of three numbers

    Write a program to check whether a given year is a leap year.

  • Conditional

    statements

    4

    Develop a program that takes two integers A and B and

    checks whether both are double digit numbers. If any one of them is not double digit number then return false and end the program. If both are double digit numbers then dispaly

    odd sum, if sum of A and B is odd and display even sum, if sum of A and B is even.

    Develop a program that will read marks of a student in 3

    subjects and display Grade of student according to his/her

    Average marks using if-else ladder where

    Average> 80 then Grade = A

    Average between 61 & 80 then Grade = B

    Average between 51 & 60 then Grade = C

    Average between 41 & 50 then Grade = D

    Average between 35 & 40 then Grade = E

    Marks < 35 then F (Fail)

    5

    Write a C Program to input Employee Id and basic pay of an

    employee and then print Employee Id, HRA and Special

    allowance. Consider HRA is 20% of basic or Rs. 7000/

    whichever is less and Special allowance is 10% of basic pay

    whenever basic exceeds Rs 10000, Otherwise it is 5% of basic

    pay.

    Write a program to read a number between 1 and 7 and then

    print its corresponding week name using switch-case and else if ladder.

    6

    Write a program to read a character from the user and then

    find out whether it is vowel or consonant using else-if ladder

    and switch statement.

    Using else-if ladder and switch statement write a program to

    read two integer operands and one arithmetic operator from

    the user and then perform that operation on given operands

    and print the calculated value.

    Develop a program for current billing System based on the

    given requirements using if else ladder.

    Units Consumed Rate of Charge

    0-200 Rs. 0.50 per unit

    201- 400 Rs. 0.65 per unit in excess of 200 units

    401- 600 Rs. 0.80 per unit in excess of 400 units

    601 and above Rs. 1.00 per unit in excess of 600 units

    Control

    statements

    7

    Write a C program to find sum of digits of a given number.

    Write a program to generate Lucas sequence.

    The Lucas sequence is 2, 1, 3, 4, 7, 11, 18, 29 so on.

    8

    Develop a menu drive program for the following requirements

    a. Find the given number is even or odd b. Find the given number is prime or not c. Find the given number is Armstrong or not d. Find the given number is Palindrome or not

    9

    Develop a menu drive program for the following requirements

    a. Find the LCM of given two numbers b. Find the GCD of given two numbers c. Find the factorial of a given positive number

  • Arrays

    10

    Develop a program that takes 10 integers as input and prints

    the largest integer and its location in the array.

    Develop a program to perform following operations on

    matrices.

    a. Find the sum of given two matrices. b. Find the difference of given two matrices. c. Find the transpose of a given matrix.

    Strings

    11

    Develop a program to perform following operations on given

    String/s.

    strlen

    strcpy

    strcat

    strrev

    strcmp

    strcmpi

    strupr strlwr

    Develop a program to count the number of vowels,

    consonants, digits, spaces, other symbols and words in a given

    text and find the percentage of vowels, consonants, digits,

    spaces, other symbols of the same text.

    12

    Develop a program to sort given n number of strings in below

    mentioned order using functions.

    Sort strings in alphabetical order

    Sort strings based on their length

    Develop a program that takes a string as input and displays the

    string after removing the repeated characters.(Consider lower

    case character and upper case character is same)

    Functions

    13

    Develop a program to multiply two matrices using function.

    Develop a program to find given matrix is symmetric or not

    using function.

    14

    Develop a program to find the factorial of a given positive

    integer using recursion.

    Write a program to print the n terms of Fibonacci series

    without using control statements

    Structures 15

    Develop a program to read N students details and sort the

    structures as per total marks obtained by them, by creating a

    structure to store the following details.

    Roll number, name, marks1, marks2, marks3

    Develop a program using array of structures to create a

    student structure with name, Dept Name, date of joining, read

    data for 5 students and sort it with the following options

    Sort by name

    Sort by date of joining.

  • Practice Programs:

    1) Write a C program to calculate the following sum of series with no of terms.

    Sum=1 - x2/2! + x4/4! x6/6! + x8/8! x10/10!.......n terms

    2) Write a C program to find all possible roots of a quadratic equation.

    3) A company sells five different products with prices shown in the following table.

    Product Number Retail Price Unit(in Rs)

    1 15.50

    2 19.25

    3 14.75

    4 25.00

    5 12.20

    Write a program using switch-case construct that reads the product number and

    number of units sold and display the amount to be paid.

    4) Write a program to find the median of a given list of numbers.

    5) Write a menu driven program to perform following operations in a given list

    i. Insert an element in to the list at a given position. ii. Delete an element from the list at a given position.

    6) Write a program to print the following triangle

    1

    1 2

    1 2 3

    1 2 3 4

    ----------------------------up to n line.

    7) Write a program to print all multiplication tables between two limts.

    8) Write a program to perform binary search and linear search.

    9) Write a program to convert each character of a string into the next character and

    print the same.

    10)Write a program to print the binary equivalent of a given number using recursion