Institute of Technology B.Tech. Semester I/II (All Branches) CE104 Computer Programming List of Experiments
Sr. Week List of Experiments Mapped
No. No.# COs 1. 1 a. Elementary commands in LINUX/UNIX/Ubuntu b. Writing and compiling a simple C program (“Hello 1 World”) in LINUX/UNIX/Ubuntu c. Demonstrate different escape sequences 2. 2 a. Introduction to CodeBlocks IDE. Use CodeBlock to write and compile a simple C program (“Hello World”). b. Write C programs: 1 i. To scan and print values of different types of variables ii. To print address of a variable 3 3 Write C programs: a. To scan two numbers and display result of different arithmetic operations. b. Mr. Desai is working in Maruti Suzuki India Ltd. He wants to calculate his gross salary which includes 120% DA of basic salary and 20% HRA of basic salary. Mr. Desai knows his basic salary, so kindly give him the gross salary (Gross Salary = Basic + DA + HRA). c. The driver is driving a car from city Ahmedabad to city Mumbai, in Ahmedabad temperature displays in Celsius while in Mumbai the temperature displayed in Fahrenheit, a driver wants to find the difference between 1,2,3 the temperatures of two cities in celcius. d. To find greatest of two and three numbers using the ternary operator e. To calculate simple interest** f. To find area and perimeter of a circle and rectangle** g. To compute final marks as the weighted average of CE (40%), SEE (40%) and LPW (20%) examination. Scan marks in each component from total of 100 marks** h. To swap the value of two numbers (i) using and (ii) without using a temporary variable.** i. To separate and print digits of a three digit scanned integer** 4 4 Write C programs: a. Write C programs which displays AND, OR, XOR results of all elements of the given sequence without using bitwise operator: If the given sequence is 1 1 0 1 then 1,2,3 result should be displayed as below: Use appropriate control construct. Input Logical Result Gate 1101 AND 0 1101 OR 1 1101 XOR 1 b. Write a program to take the values for A, B, C of a quadratic equation A∗X2+B∗X+C=0 and then find all the roots of the equation. It is guaranteed that A ≠ 0 and that the equation has at least one real root. c. In an organization, employees are paid on hourly basis. Clerks are paid 100/hr, Teachers are paid 200/hr and Principal is paid 400/hr. If the weekly hours exceeds 44, then employee should be paid 2 times their regular pay for the overtime. Write a C program to compute the weekly salary of the employee and also the program should take care that the employee should not be paid for hours beyond 50 in a week. Use best suitable control construct to implement the program. d. There were three friends: Pat, Nog and Brow. They were playing a fishing game wherein they have to catch the fishes. Number of fishes caught by each were recorded. Write a C program to find out the winner of the game using (i) else if ladder (ii) switch statement e. Ajay and Amit are playing a game with a number X. In one turn, they can multiply X by 2. The goal of the game is to make X divisible by 10. Write a C program to find the number of turns necessary to win the game (it may be possible to win in zero turn, 1 turn or it might be impossible (-1 turns)).**. f. Write a program to implement a simple number guessing game. Program should generate an integer randomly and ask the user to guess the integer. Based on the number guessed, it should display the appropriate message (correct or incorrect)**. g. Write a C program to find the grade of a student based on the following policy.** Class test: 12% weightage, Tutorial-12%, SE:16%, LPW:20%, weightage, SEE:40%,weightage. Grade is decided based on the below range of total marks. 91–100 A+, 81-90-A,71-80,B+,61-70-B,51-60-C+,>40- C,<40-Fail. 5 5 & 6 Write C Programs: a. To display 1 12 123 1,2,3 b. To display 1 22 333 c. To display * *** ***** d. To display 1 121 12321 e. To check whether the input number is an Armstrong number f. To check whether the entered number is Prime g. To write amount in words (e.g. 125 is one hundred twenty five) h. To display Pascal triangle** i. To check whether the entered number is Palindrome** j. Enhance the number guessing game developed earlier. The program should now display more appropriate message (Greater, Smaller or Correct). It should allow maximum 5 attempts from the user and still if the user cannot guess the number correctly, it should display “Sorry”** 6. 8 Suppose that the class has 10 students. Each student study four subjects; C programming, Engineering Graphics, communication skills, Mathematics. Write a C program a. To find total marks in all subjects obtained by each student. b. To find average marks obtained by all 10 students in C programming subject. 1,2,3 c. To sort the one dimensional array in an ascending or descending order as per the user choice d. To read CE, SEE and LPW marks attained in different subjects and decide the strongest and the weakest subject based on total marks. Identify the weakest and the strongest components in the weakest subject.(students can perform matrix addition and multiplication on above description) 7 9 Write C programs: a. To check whether the input string is palindrome b. To check whether the input string is in title case c. To (i) find length (ii) copy (iii) compare and (iv) reverse the input string using standard-library functions 1,2,3 d. To reverse the string without using strrev(). e. To encrypt an uppercase text message using Caesar cipher method. (e.g. HELLO will be encrypted to KHOOR)**. 8 10 a. Create a structure which holds various attributes (e.g. name, id, basic_salary, DA%, HRA%, total_salary etc.) of 1,2,3 an employee. Write a program which allows you to scan these (except total_salary) attributes for 3 employees. The program should support following operations: i. Display (total salary of the selected employee) ii. Max (find and display name of the employee with maximum salary) b. Repeat the above program using array of structure** 9 13 a. Consider a currency system in which there are notes of seven denominations, namely Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 20, Rs. 50 and Rs. 100. A sum of Rs. N is entered as an input. Write a function to compute the smallest number of notes that will combine to give Rs. N. b. Consider the example where n = 79815 and I need to find the position of a value "1" in the given number. The program should display "Position = 2" when scanning from right to left. c. Write a program to compute F(n) such that F(n) = 0, if n = 0, F(n) = 1, if n = 1, otherwise F(n) = F(n - 1) + F(n - 2). d. In statistics, the standard deviation (SD, also represented by the Greek letter sigma σ or the Latin letter s) is a measure that is used to quantify the amount of variation or dispersion of a set of data 1,2,3 values. A low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the data points are spread out over a wider range of values. Write a program to find standard deviation using function. e. Write a program to compute F(n, r) where F(n, r) can be recursively defined as F(n, r) = F(n - 1, r) + F(n - 1, r - 1).** f. Implement arithmetic calculator (supporting 4 basic operations) using user defined functions. There has to be a separate functions for each of the operations. Result must be a global variable and it should store the resultant value of the operation based on user choice.** g. Repeat the above program where each function is in a separate file.** 10 14 a. Write a program to swap two numbers using user defined functions and passing by pointers. b. Write a UDF which can accept a one-dimensional array as an argument. The function should add 1 to all odd element of the array and 2 to all even elements of the 1,2,3 array. The final array should be displayed by the main() function. Repeat this program for two and three dimensional array. c. Write a UDF which accepts three strings as arguments. The function should concatenate first two strings and keep the result in the third string which should be displayed by the main() function. 11 15 Write C Programs: a. To calculate the length of a file 1,2,3 b. To concatenate two files c. To copy content of one file in to the another file