You are on page 1of 4

ASSIGNMENT OF ‘C’ LANGUAGE

FUNDAMENTAL
1. Print your name and address.
2. Addition of two numbers.
3. Average of three numbers.
4. Find the area and the perimeter of a triangle.
5. Convert a Fahrenheit temperature into Celsius temperature.
6. Calculate V = U + FT
7. Find the roots of a Quadratic Equation.
CONDITION
1. Test whether an inputted no. is odd or even.
2. Find maximum of two nos.
3. Find the maximum of five inputted no.
4. Enter the sales value and calculate the commission.
Sales value Commission
Below 5000 5% of sales
Between 5000 to 10000 10% of sales (subject to minimum of 600 & maximum of 900)
More than 10000 25% of sales + Rs.100 incentive
5. Enter marks of five subjects and Calculate total marks and find out the grade of each student.
Total marks Grade
<120 F
<150 D
<210 C
<240 B
<270 A
>=270 O

6. Display all 2 digits number which are divisible 3 but not divisible by 9.
7. Given a 4 digit no. representing a year write a program to find out whether it is a leap year.
8. 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!
TERNARY OPERATOR
1. Find out the largest value among three variables using TERNARY OPERATOR.
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
2. Write a program that will convert a positive integer to a Roman numerical (12-XII, 14-XIV etc.)
3. Write a program to check whether a inputted character is Vowel or Constant.
4. Write a program where a student has five subjects, find out the total marks and calculate the grade:
total>=60---1st div; total>=40---2nd div; total>=30 ---3rd div.
LOOP
1. Series print->1, 2, 3, 4, 5, 6,-----------.
2. Series print->2, 4, 6, 8, ------OR 1, 3, 5, 7, 9, -------.
3. Print the Fibonacci series: 0,1, 1, 2, 3, 5, 8, ---------------, n
4. WAP to Count the no. of digits (145=3).
5. WAP to Find out the Sum of Digits(145=10).
6. WAP to check a number is Armstrong no or not. (153=1^3+ 5^3+ 3^3)
7. WAP to check a number is Peterson/ Krishnamurthy no or not. (145=1!+ 4!+ 5!)
8. WAP to check a number is Palindrome or not.(121=121).
9. Factorial of any number (5=5!+4!+3!+2!+1!=120).
10. Check whether a no. is Prime or not.
11. Print Prime number between 1 to 100

SERIES:
1. Summation of Series: 1+2+3+4+........+n
2. Summation of Series: 1+3+5+7+9+.....+n
3. Summation of Series: 2+6+12+20+30+42........+(n+n^2)
4. Summation of Series: 0+1+1+2+3+5+8+13+.....+n
5. Summation of Series: 1/1!+2/2!+3/3!+4/4!+5/5!+.....+n/n!
6. Summation of Series: 1+12+123+1234+........+n
7. Summation of Series : 1+22+333+4444+........+n
8. Summation of Series: 1-x^2/2!+x^3/3!-x^4/4!.....(+/-)x^n/n!
9. Summation of Series: 1-x^2/2!+x^4/4!-x^6/6!.....(+/-)x^n/n!
PYRAMID:
1. Print the triangle:
*
* *
* * *
* * * *
* * * * *
2. Print the triangle:
* * * * *
* * * *
* * *
* *
*
3. Print the triangle:
*
* *
* * *
* * * *
* * * * *
4. Print the triangle:
* * * * *
* * * *
* * *
* *
*
5. Print the pyramid
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
6. Print the triangle:
1
1 2
1 2 3
1 2 3 4
7. Print the triangle:
1
2 3
4 5 6
7 8 9 10
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
1 2 1
1 2 3 2 1
1 2 1
1
ARRAY
1. Find out the highest and lowest numbers in an array of n numbers.
2. Find out the positive and negative numbers in an array of n numbers.
3. Find the no. of odd and even no. in an array.
4. Find the frequency of an inputted number in an array.
5. Program to find the maximum and second maximum no. in an array.
6. Sorting of an array in ascending order (using bubble sort method).
7. Convert decimal no. to its equivalent binary no.
8. Convert binary no. to its equivalent decimal no.
9. Write a program for addition of two matrixes.
10. Write a program for matrix multiplication
11. Find the transpose of a given matrix.
12. Find the trace of a given matrix.
FUNCTION
1. Write a menu driven program to add, subtract, multiply, and divide two integers using functions.
2. Write a program to swap two numbers using function.
3. Write a function palindrome() which checks a number is palindrome or not.
4. Write a function b_sort() that receives an array and sort all the elements of the array.
5. Write a program using function to calculate x^y.
6. Write a function to find the factorial of a number: a) using recursion b) without using recursion
7. Write a function to print the Fibonacci series: a) using recursion b) without using recursion
8. Write a function to find the GCD & LCF of two integer numbers: a) using recursion b) without
using recursion.
STRING
1. Input a string from the user and then print it (using gets() and puts()).
2. WAP to implement strlen(), strrev(), strcpy(), strcat(), strcmp(), toupper(), tolower() string functions.
3. WAP to calculate the length of a string without using String library function.
4. Counting no. of words in a given sentence.
5. WAP to check whether a string is palindrome or not without using String library function.
6. WAP to replace each character with it’s next character of a string.
7. WAP to sort a name (i.e. Satish Chandra Samanta to S. C. Samanta).
8. WAP to print the structure HALDIA as H
HA
HAL
HALD
HALDI
HALDIA
STRUCTURES AND UNION
1. Make a student Database using Structure/ Union which contains name, roll, and mark of 3 subjects and
calculate total for two Student. Insert data into it and then print it.
2. Generate Employee Pay Slip using structure. Enter Emp. Code, Emp. Name, date of birth and basic salary.
Now display the pay slips. Where DA=50% of basic, HRA 15% of basic.
POINTER
1. Write a program to swap between two numbers using pointer.
2. Write a function to sort an array using pointer.
3. Sum of an array using dynamic memory allocation.
FILE
1. Store information in a file and Display Contains of the File.
2. Copy data from one file to another.
3. Read contains of a File and Count the numbers of Characters present in the File.
COMMAND LINE ARGUMENT
1. Write a program to add two number using command line argument
2. Write a program to count number of character in a line using command line argument

You might also like