Information Technology, UTU 203 030000 Fundamentals of Programming Problems to be solved in laboratory Note: Journal should contain followings for all problems given below:. Problem Statement 2. Algorithm 3. Flowchart 4. Program in C language (Code) 5. Sample calculation and Output Group: Sr. Allocated No Hours. 2. 3. List of Problems. Write a to display Hello, World! 2. Write a to display Your Name, Address and City in different lines. 3. Write a to display values of variables of different data types in different lines. 4. Write a to display values for variables of different. Write a to display values of variables of different data types in different lines. [Accept values for variables from the user] 2. Write a to display values for variables of different [Accept values for variables from the user]. Write a to find the area of a circle. 2. Write a to convert distance (given in centimeter) into equivalent meter. 4. Write a to evaluate: 2(x-y) + -2 =? 5. 6. 7. 8. Write a to read a four-digit number and display sum of its digits. Write a to find largest number from given three numbers. Write a to enter marks for five subjects and display the result: Percentage Result 70 Distinction 60-70 First Class 50-60 Second Class 40-50 Pass Class <40 Fail [Assume that each subject is having maximum 00 marks] Write a to accept a day of week in number and display name of the day. [-> Sunday, 2-> Monday,, 7-> Saturday] Objective Understanding structure of C printf() Using variables Formatted output scanf() typedef Arithmetic operations in C Using conditional statements Using Case structure Ms. Sonal Bhakta Page
Information Technology, UTU 203 9.. Write a to find the sum of first n even numbers. 2. Write a to find factorial of a given numbers. 0.. Write a to display series:, 4, 9, 6,., n terms 2. Write a to Calculate the sum of: +/2+/3+/4+. +/n. Write a to display pattern as below (if n=4): 2 3 4 2 3 4 3 4 4 2. Write a to display pattern as below (if n=5):?????? 3. Write a to find largest element from an array of integers. 4. Write a to perform following operations on matrices:. Addition 2. Subtraction 5. Write a to count upper case letters, lower case letters, numbers and special characters in a string. 6. Write a to print initials of a line of string. 7. Write a to perform following arithmetic operations on two numbers using methods: ) Addition 2) Subtraction 3) Multiplication 4) Division 8.. Write a to find largest element from an array of integers. 2. Write a to find length of a string 9. Write a using recursive function to display Fibonacci series:,, 2, 3, 5, 8, 3,.., n terms 20. 2. 22. Write a using pointers to compute the sum of elements stored in an array. Write a having student structure containing StudentID and Marks of 5 subjects. Accept marks of 5 students, and display the result of 5 students with their percentage in descending order of percentage. (assume that total marks for each subject is 00 marks) A file named DATA contains a series of integer numbers. Write a to read these numbers and then write all odd numbers to a file named ODD and all even numbers to a file named EVEN. Using Loops for iterative process in C Practice of Nested Loops Using Arrays String manipulation Creating and calling userdefined functions Using Recursive function Using Pointers Use of Derived Data Types File handling & Using Command line arguments Ms. Sonal Bhakta Page 2
Information Technology, UTU 203 Group: 2 Sr. Allocated No Hours. 2. 3. List of Problems. Write a to display Hello, World! 2. Write a to display Your Name, Address and City in different lines. 3. Write a to display values of variables of different data types in different lines. 4. Write a to display values for variables of different. Write a to display values of variables of different data types in different lines. [Accept values for variables from the user] 2. Write a to display values for variables of different [Accept values for variables from the user]. Write a to find area of a triangle. 2. Write a to convert temperature, given in Celsius, into its equivalent Fahrenheit. Objective Understanding structure of C printf() Using variables Formatted output scanf() typedef Arithmetic operations in C 4. Write a to evaluate: 5a 2 ( ) +7 =? 5. 6. 7. 8. 9. 0.. Write a to read a four-digit number and display square of its digits. Write a to find smallest number from given three numbers. Eligibility for admission in a course is based on following criteria: (a) Marks in Mathematics 60 (b) Marks in English 40 (c) Marks in Computer 50 (d) Total in all three subjects 200 or Total in Mathematics and Computer 50 Write a to check whether the candidate is eligible or not. Write a to accept a month in number and display name of the month. [-> January, 2-> February,, 2-> December]. Write a to find the sum of first n odd numbers. 2. Write a to print table of any number between and 0.. Write a to display series:, 8, 27, 64,., n terms 2. Write a to Calculate the sum of:,, 4, 8, 9, 27,., n terms. Write a to display pattern as below (if n=4): 2 2 2 3 3 4 Using conditional statements Using Case structure Using Loops for iterative process in C Practice of Nested Loops Ms. Sonal Bhakta Page 3
Information Technology, UTU 203 2. 3. 4. 5. 6. 7. 8. 9. Write a to display pattern as below (if n=5): a a A a A b a A b B a A b B c Write a to find smallest element from an array of integers. Write a to perform following operations on matrices:. Division [a matrix can be divided by a value n by dividing all its elements by n] 2. Transpose of matrix Write a to print following pattern if input string is Computer : C Co Com Comp Compu Comput Compute Computer Write a to remove consecutive blank spaces in a line of string. Write a to create function for finding larger number and smaller number among two given numbers.. Write a to find smallest element from an array of integers. 2. Write a to find character from a string at given position. Write a using recursive function to calculate the sum of: ^2+2^2+3^2+ +n^2 Using Arrays String manipulation Creating and calling userdefined functions Using Recursive function 20. Write a to find length of a string. Using Pointers 2. Write a with employee structure having Employee Id, Use of Derived Employee Name and Salary, accept data for 5 employees and Data Types 22. display in descending order of salary. Write a to read a file. Display report having data: number of words, number of lines and number of characters in a file. File handling & Using Command line arguments Ms. Sonal Bhakta Page 4
Information Technology, UTU 203 Group: 3 Sr. Allocated No Hours. 2. 3. List of Problems. Write a to display Hello, World! 2. Write a to display Your Name, Address and City in different lines. 3. Write a to display values of variables of different data types in different lines. 4. Write a to display values for variables of different. Write a to display values of variables of different data types in different lines. [Accept values for variables from the user] 2. Write a to display values for variables of different [Accept values for variables from the user]. Write a to find perimeter of a circle. 2. Write a to convert distance (given in kilometer) into equivalent centimeter. Objective Understanding structure of C printf() Using variables Formatted output scanf() typedef Arithmetic operations in C 4. Write a to evaluate: +2(x+y) -3 =? 5. Write a to read a four-digit number and display multiplication of its digits. 6. Write a to enter sides of a triangle and check whether the triangle is a right-angled triangle or not. Using conditional statements 7. Write a to add bonus to the balance of a bank account based on following criteria: Gender Balance Bonus (%) female more than 9000 7 female more than 4000 2 male more than 9000 5 male more than 5000 [Hint: you can assume for female and 0 for male] 8. 9. 0.. Write a to accept a digit from the user and display it in word. [0->Zero, ->One,.., 9->Nine]. Write a to find the sum of first n numbers that are divisible by 3. 2. Write a to multiply two numbers without using and / operators.. Write a to display series:, 4, 27, 64,., n terms 2. Write a to Calculate the sum of : / + 2/ + 3/2 + 4/3 + 5/5 + 6/8 + + n terms Write a to display pattern as below (if n=4): 2 4 3 5 7 4 6 8 0 Using Case structure Using Loops for iterative process in C Practice of Nested Loops Ms. Sonal Bhakta Page 5
Information Technology, UTU 203 2. Write a to display pattern as below (if n=5): a b c d e a b c d a b c a b a 3. Write a to find and display odd numbers from array with their positions in array. Using Arrays 4. 5. 6. 7. 8. Write a to perform following operations on matrices: Display diagonal elements, Sum of diagonal elements Write a to print following pattern if input string is Computer : Computer Compute Comput Compu Comp Com Co C Write a to count total number of words in a line of string. Write a to create power function. Example: power(x, y) will return the answer of x^y. Write a to search an element from array of integers. 2. Write a to find position of a character in a string. String manipulation Creating and calling userdefined functions 9. Write a using recursive function to calculate the sum of: +3+5+.+n Using Recursive function 20. 2. Write a to swap values of two variables. Write a having student structure containing Student s Roll No and Marks of 5 subjects. Accept marks of 5 students, and display the result of 5 students with their percentage in ascending order of Roll No. (assume that total marks for each subject is 00 marks) Using Pointers Use of Derived Data Types 22. Write a to append content in a file. Then display the file content. File handling & Using Command line arguments Ms. Sonal Bhakta Page 6
Information Technology, UTU 203 Group: 4 Sr. Allocated No Hours. 2. 3. List of Problems. Write a to display Hello, World! 2. Write a to display Your Name, Address and City in different lines. 3. Write a to display values of variables of different data types in different lines. 4. Write a to display values for variables of different. Write a to display values of variables of different data types in different lines. [Accept values for variables from the user] 2. Write a to display values for variables of different [Accept values for variables from the user]. Write a to find volume of a sphere. 2. Write a to convert temperature, given in Fahrenheit, into its equivalent Celsius. Objective Understanding structure of C printf() Using variables Formatted output scanf() typedef Arithmetic operations in C 4. Write a to evaluate: 2(a+b)b 2 + -5 =? 5. 6. 7. 8. 9. 0.. Write a to read a four-digit number and display cube of its digits. Write a to enter sides of a triangle and check which type of triangle it is. Write a to accept number of units produced by a worker. He/she gets bonus based on followings:,000 units or fewer, the bonus is $50,00 to 3,000 units, the bonus is $00 3,00 to 6,000 units, the bonus is $50 6,00 units or more, the bonus is $200 Write a to accept a character and check whether it is a vowel or not [using case structure].. Write a to find the sum of even numbers between to n. 2. Write a to count total digits in a given number.. Write a to display series: 0,, 3, 6, 0,., n terms 2. Write a to Calculate the sum of : 2/ + 3/2 + 5/3 + 7/4 + /5 + 3/6 + + n terms Write a to display pattern as below (if n=4): 2 2 3 2 3 4 Using conditional statements Using Case structure Using Loops for iterative process in C Practice of Nested Loops Ms. Sonal Bhakta Page 7
Information Technology, UTU 203 2. Write a to display pattern as below (if n=5):? @? @?? @? @? @?? @? 3. Write a to find and display even numbers from array with their positions in array. Using Arrays 4. Write a to perform following operations on matrices: Display lower triangle of a matrix, Display upper triangle of a matrix 5. 6. Write a to sort given string in ascending order. Write a to print each word from a line of string in different lines. String manipulation 7. 8. Write a to find square and square root of a number. Write a to sort array elements in ascending order. Write a to count vowels in a string. Creating and calling userdefined functions 9. 20. 2. Write a using recursive function to calculate the sum of: 2+4+6+.+n Using pointers, write a function that receives a character string and a character as argument and deletes all occurrences of this character in the string. The function should return the corrected string with no holes. Write a with employee structure having Employee Id, Employee Name and Salary, accept data for 5 employees and display in ascending order of Employee Id. Using Recursive function Using Pointers Use of Derived Data Types 22. Write a that reads a file containing integers and appends the sum of all the integers. File handling & Using Command line arguments Group: 5 Sr. Allocated No Hours. List of Problems. Write a to display Hello, World! 2. Write a to display Your Name, Address and City in different lines. 3. Write a to display values of variables of different data types in different lines. 4. Write a to display values for variables of different Objective Understanding structure of C printf() Using variables Formatted output Ms. Sonal Bhakta Page 8
Information Technology, UTU 203 2. 3. 4. 5. 6. 7. 8. 9. 0.. 2.. Write a to display values of variables of different data types in different lines. [Accept values for variables from the user] 2. Write a to display values for variables of different [Accept values for variables from the user]. Write a to calculate simple interest. 2. Write a to convert distance (given in feet) into equivalent meter. Write a to evaluate: 3x 2 ( ) + 0 =? Write a to read a four-digit number and display sum of its digits square. Write a to check whether the given year is a leap year or not. Admission seat for a me is subject to followings: Category Boys/Girls Percentage SCST Girls 50 SCST Boys 60 Open Girls 70 Open Boys 70 [Hint: Accept S for SCST, O for Open, G for Girls, B for Boys] Write a to display a menu and accept the choice from the user then display the choice chosen by the user. [. Insert Record 2. Update Record. 5... If input is then output should be Insert Record ]. Write a to find the sum of odd numbers between to n. 2. Write a to calculate x y without using pow() function of Math.h. Write a to display series: 2, 6, 5, 3,, n terms 2. Write a to Calculate the sum of : 2/ + 3/ + 5/2 + 7/3 + /5 + 3/8 + + n terms Write a to display pattern as below (if n=4): 2 3 4 5 6 7 8 9 0 Write a to display pattern as below (if n=5): A a B b C A a B b A a B A a A scanf() typedef Arithmetic operations in C Using conditional statements Using Case structure Using Loops for iterative process in C Practice of Nested Loops Ms. Sonal Bhakta Page 9
Information Technology, UTU 203 3. Write a to calculate sum of odd numbers in array. Using Arrays 4. 5. Write a to sort elements of a matrix by row. Write a to convert all the vowels in a given string into upper case 6. Write a to concatenate two strings. 7. 8. 9. 20. 2. 22. Write a to check whether the given number is positive, zero or negative. [Hint: function can return 0 if the number is zero, if it is positive, and - if it is negative.]. Write a to sort elements of an array in descending order. 2. Write a to count total blank spaces in a string. Write a using recursive function to calculate sum of: +2+3+.+n Write a using pointers to read in an array of integers and print its elements in reverse order. Write a having student structure containing Student s Roll No and Marks of 5 subjects. Accept marks of 5 students, and display details of failed students. (Assume that total marks for each subject is 00 marks and passing marks is 50%). Write a to copy the contents of one file into another file. String manipulation Creating and calling userdefined functions Using Recursive function Using Pointers Use of Derived Data Types File handling & Using Command line arguments Deadline to be followed for completion of practical Serial number in practical list to 5 05/08/203 6 to 8 9/08/203 9 to 2 3/08/203 3 to 6 4/09/203 7 to 22 05/0/203 Tentative Date on which must get signed Problem statements for practice. Write a to check whether the given number is between and 20 or not. 2. Write a to check whether the number is odd or even. 3. Write a to find the smaller from given three numbers. 4. Write a to sum the following series: ^3+2^3+3^3+ +n^3.(without loop) 5. Write a to display first n even numbers. 6. Write a to display first n odd numbers. 7. Write a to display even numbers between to n 8. Write a to display odd numbers between to n 9. Write a to display a given number in its reverse. 0. Write a to check whether the given number is palindrome or not.. Write a to sum the following series: ^3+2^3+3^3+ +n^3.(using loop) Ms. Sonal Bhakta Page 0
Information Technology, UTU 203 2. Write s to display following matrices (if n=3) a.) 2 3 4 5 6 7 8 9 c.) 2 3 2 3 3 2 b.) 2 3 2 3 4 3 4 5 d.) 3 2 2 3 2 3 3. Write s to print following patterns (if n=3):. 3. 2. 4. 4. Write a to find the Median from given numbers. 5. Write a to perform operations on array: a) Append elements b) Update element c) Delete element d) Sort elements e) Reverse an array of n elements f) Merge two arrays g) Remove duplicate elements from an array h) Find second largest element i) Find second smallest element 6. Write a to perform operations on matrix a) Multiplication b) Transpose c) Sum of diagonal elements d) Inverse 7. Write a to perform operations on string: ) Convert into Sentence case 2) Convert into Toggle Case 3) Delete consonants 4) Copy string 5) Concatenation 6) Reverse of String Ms. Sonal Bhakta Page
Information Technology, UTU 203 7) Input a string and display all palindrome words in a string 8. Write a to count the occurrence of particular character in the string. Example Fundamentals of Programming Character for counting occurrence is a. Output should display: Occurrence of the letter a is 3 9. A that will read a text and count all occurrences of all the words Example: Input- main text: "This is test and it is for evaluation" Output: This: is: 2 test: and: it: for: evaluation: 20. Write a to create user defined function to find the average of the 5 numbers. [one function for getting data, one for finding average and last for displaying data as well as average.] 2. Write a to sort the data using bubble sort.[make use of user defined function] 22. Write a to find the NPR, NCR with using User Defined Function. NPR = N! / (N-R)! NCR = N! / (R!(N-R). 23. Write a using pointers to read in an array of integers and print its elements in reverse order. 24. Write a function that receives a sorted array of integers and an integer value, and inserts the value in its correct place. 25. Using pointers, write a function that receives a character string and a character as argument and deletes all occurrences of this character in the string. The function should return the corrected string with no holes. 26. Write a with employee structure having Employee Id, Employee Name and Department Name, accept data for 5 employees and display data department wise. Output should be in a format as follows: Department: XXXXXXX EmployeeId EmployeeName ------------------------------------------------------ 99999 XXXXXXX 99999 XXXXXXX.... Ms. Sonal Bhakta Page 2
Information Technology, UTU 203 27. Write a to read data from the keyboard, write it to a file, again read the same data from that file, and display it on the screen. 28. Write a to write contents into a file [use fputc()]. 29. Write to read the sequential file [without using fgetc()]. 30. Write a to write a file [without using fputc()]. 3. Write a to read the file using structure. 32. Write a to write into a file using structure. Ms. Sonal Bhakta Page 3