Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
34 views

C Programming Lab Manual

This document outlines a 10 week C programming lab manual with assignments covering basic C programs, input/output, control structures, arrays, strings, functions, pointers, structures, unions and files.

Uploaded by

02. ABDUL REHMAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

C Programming Lab Manual

This document outlines a 10 week C programming lab manual with assignments covering basic C programs, input/output, control structures, arrays, strings, functions, pointers, structures, unions and files.

Uploaded by

02. ABDUL REHMAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

C Programming Lab Manual

WEEK 1: (Simple C programs)


1. Write a C program to display “This is my first C Program”.
2. Write a program to find sum, difference and product of two numbers, let the
numbers are 25 and 10.
3. Write a program to calculate the sum and average of three numbers, let the
numbers are 10, 20 and 30.
4. Write a program to print area and circumference of the circle, when radius=10.( use
PI=3.1415)
5. Write a program to calculate the gross salary of an employee when
basic salary=9400/-, DA=20% of basic salary, HRA=10% of basic salary,
CTA= 12% of basic salary, Gross salary= basic salary+DA+HRA+CTA.

WEEK 2: (Input statement scanf ())


6. Write a program to input side and find area and perimeter of a square.
7. Write a program to input length and breadth and find area and i of the rectangle.
8. Write a program to input values of p,r and t and find S.I and C.I.
S.I=p*r*t/100 C.I=A-P, where A=p*(1+r/100)t
9. (a) Write a program to swap two numbers using third variable.
(b) Write a program to swap two numbers using third variable.
10. Write a program to input temperature in Celsius (°C), Convert it in Fahrenheit (°F).

WEEK 3: (if, if else control statements)


11. Write a program to check whether the input number is positive, negative or zero.
12. Write a program to check whether the input number is even or odd.
13. Write a program to check whether the input character is vowel or consonant.
14. Write a program to input three numbers and find greatest number among them.
15. Write a program to check whether the input year is leap year or not.
(A leap year is divisible by 4 and not divisible by 100 or divisible by 400)
16. Write a program to obtain the electric bill as per the charges below
No of Units Consumed Rates (In Rs.)
500 and above 5.50
200-500 3.50
100-200 2.50
Less than 100 1.50

WEEK 4: (Loop control structures)


17. Write a program to print positive integers from 1 to 10 using for loop, while loop
and do while loop.
18. Write a program to find the factorial of a number using for loop.
19. Write a program to find the sum of natural numbers 1+2+3+4+…………….+n
using for loop.
20. Write a program to display the series 1 3 5 7 9 11………………up to n terms using
for loop.

Al-Kabir Polytechnic Page 1 Department of Computer Sc. & Engg.


21. Write a program to generate Fibonacci series up to 25 terms using for loop.
22. Write a program to Check Whether a Number is Prime or not using for loop.
23. Write a program to print the sum of digits of a number using while loop.
24. Write a program to check whether a number is Palindrome or not using while loop.
25. Write a program to check number is Armstrong or not using while loop.
(Hint: A number is Armstrong if the sum of cubes of individual digits of a number
is equal to the number itself).
26. Write a program to find GCD (greatest common divisor or HCF) and LCM (least
common multiple) of two numbers using do while loop.
27. (a) Write a program to print day name using switch case.
(b) Write a program to find whether a character is consonant or vowel using switch
case.
(c) Write a program, which takes two integer operands and one operator from the
user, performs the operation and then prints the result. (Consider the operators +, -,
*, /, % and use switch statement).
28. Write a program to print the numbers in triangular form
(i) 1 (ii) 1
12 22
123 333
1234 4444
12345 55555

WEEK 5: (1-D and 2-D Arrays)


29. Write a program to insert 5 elements into an array and print the elements of the
array.
30. Write a program to count and display positive, negative, odd and even numbers in
an array.
31. Write a program to find the largest and smallest element in Array.
32. Write a program to reverse the array elements.
33. Write a program to Search an element in array using below searching techniques..
(a) Linear Search (b) Binary Search
34. Write a program to Sort the array elements using below sorting techniques.
(a) Selection Sort (b) Bubble Sort
35. Write a program to input elements in 2-D integer array of 3 rows and 3 columns,
display the elements in matrix form with sum of diagonal elements.
36. Write a program to perform the following in 2-D arrays:
(a) Addition of two (3x3) matrices (b) Multiplication of two (3x3) matrices

WEEK 6: (Strings)
36. Write a program to read a string using gets(), find the string length without strlen().
37. Write a program to read a string and check whether it is palindrome string or not.
38. Write a program to read a string and count the numbers of vowels present in the
string.
39. Write a program to read a string using gets(), count number of uppercase,
lowercase, numeric digits and special characters in string.

Al-Kabir Polytechnic Page 2 Department of Computer Sc. & Engg.


WEEK 7: (Functions)
40. Write a program to add, subtract, multiply and divide two integers using user
defined type function with return type.
41. Write a program to swap two integers using call by value and call by reference
methods of passing arguments to a function.
42. Write a program to calculate factorial of a number using recursion.
43. Write a program to calculate sum of first 20 natural numbers using recursive
function.
44. Write a program to generate Fibonacci series using recursive function.
45. Write a program to find power of any number using recursion.
46. Write a program to find the GCD of two given integers using recursion.

WEEK 8: (Pointers)
47. Write a program to add, subtract and multiply two numbers using pointers.
48. Write a program to input and print array elements using pointers.
48. Write a program to find the sum of all array elements using pointers.
49. Write a program to find length of string using pointers.
50. Write a program to copy one string to other using pointers.

WEEK 9: (Structures & Unions)


51. Write a program to create, declare and initialize structure.
52. Write a program to store information of 5 students in structure and display it.
53. Write a program to create a structure named company which has name, address,
phone and noOfEmployee as member variables. Read name of company, its
address, phone and noOfEmployee. Finally display these member values.
54. Write a program to declare, initialize an UNION.

WEEK 10: (Files)


55. Write a program to create a file called emp.rec and store information about a person,
in terms of his name, age and salary.
56. Write a program to display the contents of a file.
57. Write a C program to copy the contents of one file to another.
58. Write a C program to count the no. of lines, characters present in the file.

Al-Kabir Polytechnic Page 3 Department of Computer Sc. & Engg.

You might also like