Вы находитесь на странице: 1из 4

C Assignments --Mr Deepak Malusare ,

Assignment Set No 1
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Accept a number and check if it is odd or even number Accept length and breadth of a rectangle and print the area of the rectangle Accept radius of a circle and print the area and circumference of it Accept temperature in Fahrenheit and print its equivalent Celsius value Accept a character and check whether it is vowel or not Accept a character and check whether it is capital or small Accept a number and print the sum of its digits Accept a number and print it in a reverse manner Accept a number and check whether it is a palindrome or not Accept a year and check if it is a leap year or not Accept a number and find the factorial of that number Accept a number and print the table of that number Accept 2 numbers as base and power and print the result as base raised to power Print all the characters with reference to the ASCII values from 0 to 255 Accept a number and check if it is an Armstrong number ( e.g. no is 153 equals to 1*1*1 + 5*5*5+3*3*3) Print first 10 prime numbers According to the Gregorian calendar, it was Monday on the date 01/01/01. if any year is input through the keyboard, write a program to find out what is the day on 1st January of that year Write a program to print the numbers 1 to 100, their squares and cubes Write a program to print tables of numbers between 2 and 9 Write a program to print all prime numbers from 1 to 300 Write a program to generate all the combinations of 1,2 and 3 using for loop Write a program to fill the entire screen with a smiling face. The smiling face symbol has an ASCII value 1. Write a program to add first seven terms of the following series using for loop 1/1!+2/2!+3/3!. Write a program to produce the following output ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A Write a program to produce the following pattern ***** **** *** ** * Write a program to produce a following pattern * ** *** **** ***** Write a program to find all magic numbers less than 1000.( An integer is said to be magic if, when we add its digits and then add the digits of the resulting sum,etc., we finally obtain the result as 1. e.g. 298 is a magic integer means 2+9+8 = 19 means 1+9=10 means 1+0=1) Write a function to determine the positive integer that has the largest persistence among two digit integers. e.g. 1) n=36 18 8 The persistence of no 36 is 2 2) n=39 27 14 4 The persistence of no 36 is 3 Accept a number and print its binary equivalent

17.
18. 19. 20. 21. 22. 23. 24.

25.

26.

27.

28.

29.

C Assignments --Mr Deepak Malusare ,

Assignment Set No 2
1. 2. 3. Accept 10 numbers in an array and print how many prime numbers are present in the accepted array Write a function that merges two sorted integer arrays into one From an array of 10 numbers by filling numbers 1 to 10 in it. Pass this array to a function and add the square of each number in the array to the original number and and store the result in the array. Print the contents of the array from main() Write a program which will accept 10 numbers in an array and find the 2nd largest no. from it. ( without using any sorting method) Implement the following procedure (called as sieve of Eratosthenes) to generate prime numbers from 1 to 100, into a program Step 1 : Fill an array num[100] with numbers from 1 to 100 Step 2 : Starting with the second entry in the array, set all its multiples to 0 Step 3 : Proceed to the next non-zero element and set all its multiples to 0 Step 4: Repeat step 3 till you have set up the multiples of all the nonzero elements to zero Step 5: At The conclusion of the step 4, all the non-zero entries left in the array would be the prime numbers so that print out these prime numbers Write a program to find the largest number from a 5 X 5 matrix Write a program to find transpose of a 4X4 matrix. The transpose of a matrix is obtained by exchanging the elements of each row with the elements of the corresponding column Write a program to add two 4 X 4 matrices Write a program multiply any 2two 3X3 matrices Write a program to sort all elements of a 3X3 matrix. Write a program to find whether a given square matrix is symmetric Write a function to find the norm of a matrix. The norm is defined as the square root of the sum of the squares of all elements in the matrix Accept a string of characters and arrange the characters in alphabetical order e.g. str is STRING o/p GINRST Accept a string. Write a function that returns number of blanks in the string Write a function which concatenates a string to the left of the given string Write a program to delete all vowels from the sentence. Assume that the sentence is not more than 80 characters long Write a program that reads a line and deletes from it all occurrences of the word the Write a program to count the number of occurrences of any two vowels in a line of text. For example, in the following sentence : Please read this application and give me gratuity Output : Such occurrences are ea,ea,ui.

4.
5.

6. 7. 8. 9. 10. 11. 12.

13.
14. 15. 16. 17. 18.

Assignment Set No 3
1. Accept a string and choice uppercase or lowercase ( U/L). Write a function to convert the given string to upper case (U) or lowercase (L) according to the users choice. 2. Write a function ispal(char s[]) which returns 0 if s is not palindrome and 1 if it is. 3. Write a function void xstrcat(char s[],chart[]) that appends the string t to the end of string s and stores it again in string s[]. 4. Write a function that returns the number of vowels inside the passed string 5. Write a function that reverse the string 6. Write a function that will print all the rotations of the given string ( using a for loop) e.g. s1= space o/p space paces acesp cespa espac 7. Write a function that accepts 2 strings and print the common characters from two strings 8. Write a function that replaces two or more consecutive blanks in the string by a single space. e.g. I/P Best of luck O/P Best of luck 9. Write a function that accepts a string and prints 1st character of each word in capital letters e.g. I/P How are you? O/P How Are You? 10. Write a function insert (str,newstr,position) that inserts newstr at the given position in the string str. 11. Write a function int count_words(str) that returns the number of words in the string str 12. Write a function void substr(sourcestr,start, no_of_chars,resultstr) that copies characters starting from start and equal to no_of_chars in the resultstr.

C Assignments --Mr Deepak Malusare ,

13. Write function void remove(sourcestr,start, no_of chars,resultstr) that removes characters starting from start and equal to no_of_chars in the resultstr. 14. Write a function strlen(str) that returns length of the string str 15. Write a function strcmp(s1,s2) that returns 0 if strings s1 and s2 are equal, otherwise returns the ascii difference between the first mismatched characters. 16. Write a function strcpy(s1,s2) that copies string s1 into s2. 17. Write a function strlwr(s1) that converts string s1 to lowercase. 18. Write a function srrchr(str,ch) that returns the first occurrence of character ch in the string str 19. Write a function strstr(str1,str2) that returns the first occurrence of string str2 in the string str1. 20. Write function strset(str,ch) that sets all characters of the string str to character ch. 21. Write a recursive function to print factorial of a number 22. Write a recursive function to print the product of digits of a number 23. Write a recursive function to convert a decimal to binary 24. Write a recursive function to print a string in backward direction 25. Write a recursive function to find the prime factors of a number 26. Write a recursive function to obtain first 25 terms in the fibonacci series.

Assignment Set No 4
1.Write a program to accept your name print it using pointers. 2.Write a program to combine two strings using pointers. 3.Write a program to find the length of a string using pointers. 4.Write a program to interchange the values of two variables using pointers 5.Write a program to find maximum salary of an employee among ten using pointer 6.Write a program to find prime numbers from 1 to entered number using pointers. 7.Write a program to find the reverse the elements of an array using pointers. 8.Write a program to multiply each element of an array using pointers. Arrays, Functions and Pointers 1.Write a function which will accept a string and convert all characters to uppercase and vice versa 2.Write a program to accept 10 names from the user and display the position the entered string in the array. 3.Write a program that will print itself. 4.Write a program to build the following utilities:a. String Copy b. String Reverse c. String Concatenation d. String Length 5. Write a program that prints an entered string in a reverse order using recursion Working with Structure 1.Write a program having records of 10 students having fields as Roll no., Name, Address and marks scored in last exam. Now find out grade of each student as A,B,C or D depending upon percentage as follows. A grade -- above 85 B grade -- between 75 to 85 C grade -- between 60 to 75 D grade -- between 50 to 60 Fail -- below 50 2.Write a program to accept Empno, Name, Deptno and Salary and find out highest salary in each department 3.Write a program to implement following functions on "Student Database". (Student's database will contain information like roll no, Name, address, age, class, percent, marks) a. Addition of a record. b. Deletion of record c. Modification of record d. Display a record e. Display all records 4.Define a structure containing fields "Employee Name, Number of hours worked, Hourly Rate". Calculate gross pay of each employee using following conditions: a. Straight time 40 hrs/week b. Overtime payment is 1 times of normal pay. 5.Define a structure containing fields "Salesperson Name, Gross sales, Commission Rate". Payment of each salesperson is RS.150/- per week plus commission. Calculate and display earnings of each salesperson.

C Assignments --Mr Deepak Malusare ,

6.Prepare a list of all the birth dates of your friends. Write a program to retrieve birth date of any person given his/her Name. Also for given month it should display list of all friends whose birthdays are there in that particular month. 7.Consider a structure like struct player { int no; char Name[25]; int teamno; int batt-avg; } Store the data of 5 players in a file and write program that will print the highest batting average player from each team. 8. Consider a union like union student { int rollno; char Name[25]; char doa; } Store the data of 10 students in a file and 9.Consider a union like union employee { int empno; char Name[25]; char doj; float salary; } Store the data of 10 employees in a file and write program that will print the Name of the employee who is earning the highest salary in the company. LINKED LIST 1. Create a linked list having the following menus and submenus Main Menu 1.Create List 2.Print List 3.Insert Record a. Insert before First b. Insert after last c. Insert in between 4.Delete Record a. Delete First b. Delete last c. Delete in between 5.Sort a. By Roll No b. By Name 6.Write to a file 7.Open a file 8.Exit FILES 1.Write a program to read a file and print its contents on the screen 2.Read a file and copy its contents to a user-defined file. 3.Read a file and print all vowels from the file. 4. Read a file and convert all lower case letters to upper case

Вам также может понравиться