Chapter 1- Variables, Constants and Keywords
First program in c introducing variables
Basic program in c- taking input
Ex1- create a program to add two numbers
Q1- Write a C program to calculate area of a rectangle
a) Using hard coded inputs
b) Using inputs supplied by the user
Q2-Calculate the area of a circle
Q4-Calculate the volume of a cylinder of given radius and height
Chapter 2- Instructions and Operators
Type Declaration instruction
Arithmetic Instructions(Use of all arithmetic operators)
example 1 - Area of a square with power function(math.h library)
example- Program on Type conversion
Program on Operator Associativity and Operator priority
Q2.- Write a program to check whether a number is divisible by 97 or not.
Q3- Write a program to find the square of a number input by the user.
Q4- Write a program to calculate the average of three numbers.
Q5- Write a program to find the ASCII value of a given ASCII code.
Q6- Write a program to find the ASCII code of a given ASCII value.
Q7- Write a program to find the square root of a number.
Chapter 3- Conditional Instructions
- Checking even-odd number program using if condition
- take user age and tell he can drive or not
- Program to tell that you can vote or not by taking the age
- if-else condition drive program using logical operators
- A basic Program on else-if clause taking numbers and telling what the numbers are
- A leap year checking Program
- The marks obtained by a student in 5 different subjects are input. Tell a devision as per the following rules--
1.if marks are equal or above than 60- 1st devision 2.if marks are between 45 and 60- 2nd devision 3.if marks are between 33 and 45- 3rd devision 4.If marks are below 33-- fail
8.A if-else program using ternary operator
- write a program to find out whether a student is pass or fail, ifit requires total 40% and at least 33% in each subject to pass. Assume 3 subjects and take marks as an input from the user
- Calculate income tax paid by an employee to the govn as per the stats below-
Income Slab Tax 2.5L-5.0L 5% 5.0L-10.0L 20% above 10.0L 30% there is no tax below 2.5L.
- Write a program to determine whether a character enterd by the user is lowercase or not
- write a program to find greatest of four numbers entered by the user.
- Write a program to determine the entered is a vowel or a constant.
Chapter 4- Loop Control Instructions
1.Print 1 to 100 numbers one by one
2.Example of while loop
3.write a program to print natural numbers from 10 to 20 when initial loop counter is initialized to 0
4.write a program to calculate simple interest for 3 sets of p,n and r.
5.See an example of increment and decrement operators
6.Program on do while loop.
7.Write a program to print first n natural numbers using do-while loop.
8.Write a program to print zero to 10 numbers using for loop.
9.example of using for loop.
10.Write a program to print first n numbers using for loop.
11.Decrementing for loop.
12.write a program to print n natural numbers in reverse order.
13.Write a program to print the table of any number
14.Using break statement inside a do while loop
15.Using continue statement
- Write a program to print a multiplication table of a given number.
- Write a program to print multiplication table of 10 in reverse order
- Write a program to sum first 10 natural numbers.
a. Using For loop b. Using While loop c. Using Do while loop
- Write a program to calculate the sum of the numbers occuring in the multiplication table of 8.(Consider 8x1 to 8x10)
5. Write a program to calculate the factorial of a given number using a for loop
6. Repeat 8 using while loop
7. Write a program to check whether a given number is prime or not using loops
8. Implement 7 question with other loops
a. using while loop b.Using do while loop
9. Write a program to reverse any number
10. Write a program to add all digits of a given number
11. Write a program to sort all even and odd numbers
Chapter 5- Functions and Recursion
- Syntax of Using Functions
- Write a program with three functions
- Every function gets called directly or indirectly from main()
- Sum program using functions.
- change is a function which changes a to 77.
- Use the library functions to calculate the area of a square with side a.
- Write a program to find the factorial of a given number using recursive function method.
- Write a program using functions to find average of three numbers
- Write a function to convert celcius temperature into fahrenheit.
- write a function to calculate force if attraction on a body of mass m exerted by earth(g = 9. m/s^2)
- Write a program using recursion to calculate nth element of fibonacci series.
- Write a recursive function to calculate the sum of first n natural numbers.
- Write a program using functions to print the following pattern(first n lines)
* *** *****
Chapter 6- Pointers
- A program to demonstrate pointers.
- Program to demonstrate pointer to a pointer
- program using simple function.
- Example Program(Swaping variables) using call by reference function.
- Write a program to print the address of a vairable.Use this address to get the value of this variable.
- Write a program having a variable i. Pass this variable to a function and print its address. Are those addresses same? Why?
- Write a program to change the value of a variable to ten times of its current value. Write a function and pass the value by reference.
- Write a program using function which calculate the sum and average of two numbers. Use pointers and print the values of sum and average in main().
- write a program to print the value of a variable i by using "pointer to pointer"type of variable.
- Try problem 3 using call by value and verify that it doesn't change the value of the said variable.
Chapter 7- Arrays
1.Write a program to accept marks in 4 subjects by the user in an array and print them to the screen one by one.
2.Write a program to accept marks of 5 students in an array and print them to the screen one by one.
3.Initialization of an array
4.Examples on pointer arithmetic.
5.Try these operations on another variable by creating poitners in a seperate program. Demonstrate all the four operations.
6.Examples on Accessing arrays using pointers.
7.Example on accessing arrays
8.Example on 2-D arrays
9.Example on 3-D arrays
10.Create a 2-d array by taking input from the user.Write a display function to print the content of this 2-d array on the screen.
- Create an array of 10 numbers. Verify using pointer arithmetic that (ptr+2) points to the third element where ptr is a pointer pointing to the first element of the array.
- Write a program to create an array of 10 integers and store multiplication table of 5 in it.
- Repeat problem 2 for general input provided by the user using scanf.
- Write a program containing a function which reverses the array passed to it.
- Write a program containing functions which counts the number of positive integers in an array.
- Create an array of size 3x10 containing multiplication tables of the numbers 2,7 and 9 respectively.
- Repeat problem 7 for a custom input given.
- create a 3-D array and print the address of its elements in increasing order.
- create an array of size n, input the elements of the array, sum them and print the sum of the elements in a new line.
Chapter 8- Strings
- Creating strings
- Create a string using "" and print its content using a loop.
- Create a string, Take input from user and print the string.
- puts() example.
- Reinitializing string.
- get the length of the string using standard library function..
- Implement function that work same as strlen().
- Copy string using strcopy() function.
- Using strcat() function.
- Write a program to take string as an input from an user using %c and %s. Confirm that the strings are equal.
- Write your own strlen() function.
- Write a function slice() to slice a string. It should change the original string such that it is now the sliced string.Take m and n as the start and ending position for slice.
- Write your own version of strcpy() function from < string.h >
- Write a program to encrypt a string by adding 1 to the ASCII value of its characters.
- Write a program to decrypt the string encrypted using encrypte function in problem 5.
- Write a program to count the occurence of a given character in a string.
- Write a program to check whether a given character is present in a string or not.
A program which takes your password or any msg and display encrypted code if you want to decrypt it can decrypt it.
Chapter 9- Structures
- Syntax of using structures. Defining structures and using user defined data types.
- Write a program to store the details of 3 employees from usr defined data.Use the structure declared above.
- Making an array of structures.
- Initializing structures
- Write a program,define structure and use with pointer and arrow operator.
- Complete this show function to display the content of employee structure.
- Using Typedef keyword in structures
- Create a two dimensional vector using structures.
- Write a function sumvector which returns the sum of two vectors passed to it. The vectors must be two dimensional.
- Write a program to illustrate the use of arrow operator -> in C.
- Write a program with a structure representing a complex number.
- Create an array of 5 complex numbers created in problem 5 and display them with the help of a display function.The values must be taken as an input from the user.
- Write problem 4's structure using typedef keyword.
- Create a structure representing a bank account of a customer. What fields did you use and why?
- Write a structure capable of storing date. Write a function to compare those dates.
- Solve problem 8 for time using typedef keyword.
Chapter 10- File handling
- Writing a file using w mode.
- Take input integers and a string from a text file and print on the screen.
- Modfiy the above program to check whether the file exists or not before opening the file.
- Example of writin to a file
- Get input from user of numbers and write into the file.
6.Using fgetc() function.
7.Using fputc() function. - Reading a Full File.
- Write a prorgam to read three integers from a file.
- Write a program to generate multiplication table of a given number in text format.Make sure that the file is readable and well formatted.
- Write a program to read a text file character by character and write its content twice. in a seperate file.
- Take name and salery of two employees as input from the user and write them to a text file in the following format.
name1,3300
name2,7700 - Write a program to modify a fille containing an integer to double its value.
Chapter 11- Dynamic Memory allocation
- What is sizeof() operator ?
- Using malloc() function.
- Write a program to create a dynamic array of 5 floats using malloc().
- Using calloc() function.
- Write a program to create an array of size n using calloc where n is an integer entered by the user.
- Write a program to demonstrate the usage of free() with malloc().
- Using realloc function.
- Write a program to dynamically create an array of size 6 capable of storing 6 integers.
- Use the array in problem 1 to store 6 integers entered by the user.
- Solve problem 1 using calloc().
- Create an array dynamically capable of storing 5 integers. Now use realloc so that is can now store 10 integers.
- Create an array of multiplication table of 7 upto 10(7x10 = 70).Use realloc to make it store 15 numbers.
- Attempt problem 4 using calloc().