0% found this document useful (0 votes)
28 views2 pages

Exercices On C Programming Language

The document outlines a series of exercises designed to teach the C programming language, covering topics such as basics, control structures, functions, arrays, pointers, strings, file handling, and advanced topics. Each section includes specific programming tasks, such as printing messages, performing calculations, manipulating data structures, and handling files. Additionally, there are extra challenges to deepen understanding and application of C programming concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Exercices On C Programming Language

The document outlines a series of exercises designed to teach the C programming language, covering topics such as basics, control structures, functions, arrays, pointers, strings, file handling, and advanced topics. Each section includes specific programming tasks, such as printing messages, performing calculations, manipulating data structures, and handling files. Additionally, there are extra challenges to deepen understanding and application of C programming concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

EXERCICES ON C PROGRAMMING LANGUAGE

Exercises on C Programming

1. Basics of C Programming

 Write a program in C to print "Hello, World!" on the console.


 Create a program that declares three variables of different data types (e.g., int, float,
char), assigns them values, and prints these values.
 Calculate the area of a circle given its radius. Use the formula: Area = π * radius *
radius. (Assume π = 3.14159).

2. Control Structures

 Write a program that checks whether a number entered by the user is positive,
negative, or zero using if-else statements.
 Use a switch statement to create a simple calculator that performs addition,
subtraction, multiplication, or division based on user input.
 Write a program to print the multiplication table of a number entered by the user using
a for loop.

3. Functions

 Define a function to find the maximum of two numbers. Use this function in main()
with user-input values.
 Write a program that computes the factorial of a number using recursion.
 Write a program with a user-defined function that calculates the sum of all elements in
an array.

4. Arrays

 Write a program to read 10 integers from the user, store them in an array, and print the
sum and average of the numbers.
 Create a program that sorts an array of integers in ascending order using the Bubble
Sort algorithm.
 Develop a program that finds the smallest and largest elements in an array.

5. Pointers

 Create a program that demonstrates the use of pointers by printing the address and
value of a variable.
 Write a program to swap two numbers using pointers.
 Implement a program that dynamically allocates memory for an array using malloc()
and then frees the memory.

6. Strings

 Write a program to count the number of vowels, consonants, digits, and whitespace
characters in a string.
 Create a function to reverse a string without using predefined string functions.
 Write a program to check if a string is a palindrome (reads the same forward and
backward).

7. File Handling

 Write a program to write a series of numbers into a file and then read them back to
display on the console.
 Develop a program to count the number of words in a text file.
 Write a program to copy the content of one file to another.

8. Advanced Topics

 Use structures to define a Student record with fields like name, roll number, and
marks. Write a program to create and display details of 5 students.
 Create a program that uses a structure and a union, highlighting their differences in
memory allocation.
 Write a program to demonstrate the use of command-line arguments by calculating the
sum of integers passed as arguments.

Additional Challenges

 Implement a program that calculates the Fibonacci sequence both iteratively and
recursively, and compare their execution times.
 Write a program that uses pointers and functions to transpose a 2D matrix.
 Create a program that simulates a simple banking system using functions and
structures.

You might also like