Você está na página 1de 7

Page No.

: 1

ASSIGNMENT OF ‘C’ LANGUAGE

FUNDAMENTAL

1. The hello world program (using printf statement)


2. Addition of two numbers.
3. Average of three numbers.
4. Find the area and the perimeter of a triangle.
5. Convert a celcious temparature to its farenheit.
6. Convert a Farenheit temparature into Celcious temperature.

CONDITION

1. Test whether an inputted no. is odd or even.


2. Find the maximum of three inputted no.
3. Find the maximum of four inputted no.
4. Sales value Commission
Below 5000 5% of sales
Between 5000 to 1000010% of sales (subject to minimum of 600 & maximum of 900)
More than 10000 25% of sales + Rs.100 incentive
Enter the sales value and calculate the commission.
5. Find maximum of three nos. using turnery operator.
6. Total marks Grade
<120 F
<150 D
<210 C
<240 B
<270 A
>=270 S
Calculate total marks and grade of each students.
7. Display all 2 digited no. which are divisible 3 but not divisible by 9.
8. Given a 4 digit no. representing a year write a program to find out whether it is a leap year.
9. A program that will print different messages at different times of day. These are –
12 midnight to 12 noon - good morning !
12 noon to 6 p.m. - good evening !
6 p.m. to 12 midnight - good night !
else - time invalid !

LOOP

1. Series print->1, 2, 3, 4, 5, 6,-----------.

2. Series print->2, 4, 6, 8, ----------------.


3. Series print->1, 3, 5, 7, 9, ----------------.
4. Print the series->1, 4, 9, 16, 25, ---------------.
Page No.: 2
5. Sum of series ->2, 6, 12, 20, 30, 42, -----------------.(n+n^2)
6. Series print --> 1, 10, 35, 84, 165, -----------------------
7. Print the series: 1, 3, 7, 13, 21, 31, ---------.
8. Series print ->100, 99, 97, 94, 90, ----------------.
9. Sum of 1+ 3+ 7+ 15+ 31+ ------------------
10. Print the Fibonacci series: 1, 1, 2, 3, 5, 8, ---------------, n
11. Factorial of any number.
12. Count the no. of digits (145=>3)
1. Find out the sum of digits (145=>10)
2. Reverse of an inputted no. (145=>541)
3. Count the odd digits of an inputted no.
4. Print the sum of the series: 1+ 2- 3+ 4+ 5- 6+ ----------
5. Display the series: 1/1!, 2/2!, 3/3! --------------
6. Series print--> -x+ x^2/2!- x^3/3!+ x^4/4!- x^5/5! ------------------
7. Display all 3 digited Armstrong no. (153=>1^3+ 5^3+ 3^3)
8. Display all 3 digited Peterson no. (145=>1!+ 4!+ 5!)
9. Check whether a no. is prime or not.
10. Check whether a no. is pefect or not (6=>1+ 2+ 3 i.e. addition of all divisible nos.)
11. Write a program to find a magic no.
12. Prime no. between 1 to 1000.
13. Terms of a A.P. or G.P. series are given(say 4 terms are given). Find the n th term of the series or
sum of n terms of the series.
14. Write a program which takes any mathematical expression (like 10*5-6) and gives the result.
15. Write a program to make a calendar.
16. Write a program to find out the age of a person from his date of birth.

PYRAMID

1. Print the triangle->


*
* *
* * *
* * * *
2. Print the triangle ->
* * * * *
* * * *
* * *
* *
*

3. Print the triangle-> 1


1 2
1 2 3
1 2 3 4

4. Print the triangle-> 1


2 2
Page No.: 3
3 3 3
4 4 4 4

5. Print the triangle-> 1


0 1
0 1 0
1 0 1 0
1 0 1 0 1

6. Print the triangle-> 1


0 1
1 0 1
0 1 0 1
1 0 1 0 1

7. Print the triangle:


1
1 2
1 2 3
1 2 3 4
8. Print the triangle::
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1

9. Print the triangle->


1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

10. Print the triangle ::


1
1 2 1
1 2 3 2 1
1 2 1
1
11. Print the triangle:
4
4 3 4
4 3 2 3 4
4 3 2 1 2 3 4
Page No.: 4

12. Print the traingle ::


4
4 3 4
4 3 2 3 4
4 3 2 1 2 3 4
4 3 2 3 4
4 3 4
4

13. Pascal triangle….


1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

ARRAY

1. Find out the highest and lowest marks between 15 marks of an array.
2. Find out the +ve and –ve nos. in an array of size 25.
3. Find the no. of odd and even no. in an array.
4. Find the frequency of an inputted no. in an array.
5. Program to find the maximum and second maximum no. in an array.
6. Addition of two matrix.
7. Subtraction of two matrix.
8. Multiplication of two matrix.
9. Find the transpose of a given matrix.
10. Sorting of an array in ascending order(using bubble sort method).
11. Convert decimal no. to its equivalent binary no.
12. Convert binary no. to its equivalent decimal no.
13. Program to calculate the mean and standard deviation.

14. Write a program to evaluate a polynomial.


P(x)=anxn+an-1xn-1+an-2xn-2+------------------+a1x+a0
15. Goldbatch conjecture is that any even no. can be expressed as an addition of two prime nos.
16. Frequency of each element in the array.
17. Design a program to implement Insertion Sort.
18. Design a program to implement Selection Sort.

SWITCH CASE

1. Using switch case write a menu driven program-


* * * MENU * * *
Enter 1 for ADD
Enter 2 for SUBTRACTION
Enter 3 for MULTIPLICATION
Enter 4 for DIVISION
Page No.: 5

Enter your option :-


Enter 1st no:
Enter 2nd no:
Result:::
2. Discount calculation using switch case.
3. Write a program to solve the quadratic equation (using switch).
( ax^2+ bx+ c=0 )
4. Write a program that will convert a positive integer to a Roman numerical (12-XII, 14-XIV etc.)

FUNCTION

1. Write a function to implement the strlen().


2. Write a function to implement the strcpy().
3. Write a function to implement the strcat().
4. Write a function to implement the strev().
5. Write a function to implement the strcmp().
6. Write a function palindrome() which checks a string is palindrome or not.
7. Write a function b_sort() that receives an array and sort all the elements of the array.
8. Write a function which will sort a character array alphabetically.
9. Write a function which will receive two sorted array as parameter and merge this two array into a third
array and return this array to main function.
10. Write a recursive function to find the factorial of a no.
11. Write a recursive function to print the Fibonacci series.

STRING HANDLING

1. Input a string from the user and then print it (using gets() and puts()).

2. Reverse of a given string.


3. Check a string is palindrome or not (Madam).
4. Find out no. of ‘a’ in an inputted string.
5. Print the following format after taking the string input—
A
A R
A R U
A R U P
6. Abbrevation (Arup Das ->A.Das).
7. Copying a substring into a string.
8. Deleting specific characters from a string.
9. Concatenating a string to the right of the given string.
10. Concatenating a string to the left of the given string.
11. Counting no. of words in a given sentence.
12. Find the no. of vowels in a string.
13. Write a program which will read a line and squeeze out all blanks from it.
14. Find all the permutations of the characters of a given string.
15. Write a program to convert upper case letter to lower case letter and vice versa.
16. Reverse a given string without using array.
Page No.: 6
17. Write a program to find out the consecutive letter in a given string.
Ex-- Augustin Output—st is consecutive letters.
18. Input a sentence print the longest word in it.
19. Accept a string of characters and also a substring. Find out how many lines the substring occurs in the
string.
20. Consider the following list of countries and their capitals-
India New Delhi
Bangladesh Dhaka
Sri Lanka Colombo
England London
Germany Berlin
Write a program that will accept the name of a country as input and output the corresponding capital. The
program should run till the string ‘END’ is encountered and print “DON’T KNOW” for unknown countries.
21. Convert each character to its ASCII equivalent.
22. Write a program that will accept two substrings as input and compare them to find the length of the
greatest common substring between the two.

STRUCTURES,UNION AND ENUM

1. Make a student structure(name,roll,3 subjects and total) , insert data into it and then print it.
2. Employee structure(code,name,date of birth,basic). Now display the pay slips.
DA=15% of basic, HRA 5% of basic(if basic greater than 10000,PF(deduction) 2% of basic.
Calculate the net pay.

3. Same student structure but at the time of print sort the structure array and print in descending order of
the total field.
4. Structure-> player and team name, batting average. After data input user give a particular team name and it
will display all records of the player of that team.

FILE

1. Creating and storing information in a file.


2. Copy data from one file to another.
3. Write in the binary file and then print it.
4. Searching for a particular record and if found then print it.
5. Write information in a student database file and then print student performance report.
6. Frequency of a particular word in a file.
7. Replace a word ‘may’ by ‘can’ in a file.
8. Remove comment line from a ‘C’ program by using file.

POINTER

1. Swap two elements using pointer.


2. Write a function to sort an array using pointer.
3. Implementing strcpy() using pointer.
4. Number input and their sum using dynamic memory allocation.
Page No.: 7

COMMAND LINE ARGUMENT

1. Sum of any number given by the user through command line argument.
2. Reading and displaying file by using command line argument.

Você também pode gostar