SAKSHAM COMPUTERS
C Programming Master Notes
Table of Contents
- Introduction to C
- Variables & Data Types
- Operators
- Conditional Statements
- Loops
- Functions
- Arrays
- Strings
- Pointers
- Structures
- File Handling
- Practice Programs
- MCQ
- Viva
Chapter 1 : Introduction to C
What is Programming?
Programming is the process of giving instructions to a computer.
Programming म्हणजे संगणकाला सूचना देण्याची प्रक्रिया.
What is C?
C is a general-purpose programming language developed by Dennis Ritchie in 1972.
Advantages of C
- Fast
- Portable
- Structured
- Efficient
Program 1 : Hello World
#includeint main() { printf("Hello World"); return 0; }
Output
Hello World
Explanation
printf() is used to display output.
Chapter 2 : Variables & Data Types
Variable
A variable is a container used to store data.
int age=20; float salary=15000; char grade='A';
Program : Store Age
#includeint main() { int age; printf("Enter Age : "); scanf("%d",&age); printf("Age=%d",age); return 0; }
Output
Enter Age : 25 Age=25
Chapter 3 : Operators
Arithmetic Operators
- +
- -
- *
- /
- %
Program : Addition
#includeint main() { int a,b; scanf("%d%d",&a,&b); printf("%d",a+b); return 0; }
Output
30
Practice Set
- Addition
- Subtraction
- Multiplication
- Division
- Area of Rectangle
Solutions
Write programs using arithmetic operators.
Chapter 4 : Conditional Statements
if
if(condition)
{
}
Program : Even Odd
#includeint main() { int n; scanf("%d",&n); if(n%2==0) printf("Even"); else printf("Odd"); return 0; }
Output
Enter Number : 10 Even
Chapter 5 : Loops
Entry Controlled Loop
- for
- while
Exit Controlled Loop
- do while
Program : Print 1 to 10
for(i=1;i<=10;i++)
{
printf("%d",i);
}
Output
1 2 3 4 5 6 7 8 9 10
Practice Set
- Table
- Factorial
- Fibonacci
- Reverse Number
- Palindrome
Chapter 6 : Functions
void display()
{
printf("Hello");
}
Recursion Example
factorial(n)
{
if(n==1)
return 1;
return n*factorial(n-1);
}
Chapter 7 : Arrays
int marks[5];
Program : Sum of Array
#includeint main() { int a[5]={10,20,30,40,50}; int i,sum=0; for(i=0;i<5;i++) sum=sum+a[i]; printf("%d",sum); }
Chapter 8 : Strings
char name[]="SAKSHAM";
String Functions
- strlen()
- strcpy()
- strcmp()
- strcat()
Chapter 9 : Pointers
int a=10; int *p=&a;
Program
printf("%d",*p);
Chapter 10 : Structures
struct Student
{
int roll;
char name[20];
float marks;
};
100 Important Programs
- Hello World
- Addition
- Area of Rectangle
- Simple Interest
- Even Odd
- Largest Number
- Leap Year
- Table
- Factorial
- Fibonacci
- Palindrome
- Prime Number
- Array Sum
- Array Average
- String Length
- String Reverse
- Pointer Example
- Structure Example
- File Handling
100 Viva Questions
- What is C?
- What is Variable?
- What is Array?
- What is Pointer?
- What is Structure?
100 MCQ Questions
Add chapter-wise MCQs here.
SAKSHAM COMPUTERS
C Programming Master Notes