Basic and Important C Programs महत्वपूर्ण एवं सामान्य सी प्रोग्राम (Sequential Structure Programs)

Sequential structure programs are the simplest programs in C language where statements are executed one after another in sequence. These programs help beginners understand variables, operators, input-output functions, formulas, and basic program logic.

Sequential structure programs C language के सबसे सरल programs होते हैं जिनमें statements क्रमवार execute होते हैं। ये programs विद्यार्थियों को variables, operators, input-output functions, formulas तथा basic programming logic समझने में सहायता करते हैं।


1. C Program to Calculate Simple Interest
1. Simple Interest निकालने का C Program

#include<stdio.h>
int main()
{
float p,r,t,si;
printf("Enter Principal, Rate and Time:\n");
scanf("%f%f%f",&p,&r,&t);
si = p*r*t/100;
printf("Simple Interest = %.2f",si);
return 0;
}

Output:

Enter Principal, Rate and Time:
1000
5
2
Simple Interest = 100.00

2. C Program to Find ASCII Value of a Character
2. Character का ASCII Value ज्ञात करने का Program

#include<stdio.h>
int main()
{
char ch;
printf("Enter any character: ");
scanf("%c",&ch);
printf("ASCII Value = %d",ch);
return 0;
}

Output:

Enter any character: A
ASCII Value = 65

3. C Program to Find Area of Triangle using Heron’s Formula
3. Heron’s Formula से Triangle का Area निकालने का Program

#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,s,area;
printf("Enter three sides of triangle:\n");
scanf("%f%f%f",&a,&b,&c);
s = (a+b+c)/2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
printf("Area of Triangle = %.2f",area);
return 0;
}

Output:

Enter three sides of triangle:
3
4
5
Area of Triangle = 6.00

4. C Program for Addition, Subtraction, Multiplication and Division
4. Addition, Subtraction, Multiplication एवं Division का Program

#include<stdio.h>
int main()
{
int a,b;
printf("Enter two numbers:\n");
scanf("%d%d",&a,&b);
printf("Addition = %d\n",a+b);
printf("Subtraction = %d\n",a-b);
printf("Multiplication = %d\n",a*b);
printf("Division = %d\n",a/b);
return 0;
}

Output:

Enter two numbers:
20
10
Addition = 30
Subtraction = 10
Multiplication = 200
Division = 2

5. C Program to Find Area and Circumference of Circle
5. Circle का Area एवं Circumference निकालने का Program

#include<stdio.h>
int main()
{
float r,area,circumference;
printf("Enter radius of circle: ");
scanf("%f",&r);
area = 3.14*r*r;
circumference = 2*3.14*r;
printf("Area = %.2f\n",area);
printf("Circumference = %.2f",circumference);
return 0;
}

Output:

Enter radius of circle: 7
Area = 153.86
Circumference = 43.96

6. C Program to Swap Two Variables without Third Variable
6. Third Variable के बिना Variables Swap करने का Program

#include<stdio.h>
int main()
{
int a,b;
printf("Enter two numbers:\n");
scanf("%d%d",&a,&b);
a = a+b;
b = a-b;
a = a-b;
printf("After Swapping:\n");
printf("a = %d\nb = %d",a,b);
return 0;
}

Output:

Enter two numbers:
10
20
After Swapping:
a = 20
b = 10

7. C Program to Swap Two Variables using Third Variable
7. Third Variable का उपयोग करके Variables Swap करने का Program

#include<stdio.h>
int main()
{
int a,b,temp;
printf("Enter two numbers:\n");
scanf("%d%d",&a,&b);
temp = a;
a = b;
b = temp;
printf("After Swapping:\n");
printf("a = %d\nb = %d",a,b);
return 0;
}

Output:

Enter two numbers:
15
25
After Swapping:
a = 25
b = 15

8. C Program to Find Square, Cube and Square Root
8. Square, Cube एवं Square Root निकालने का Program

#include<stdio.h>
#include<math.h>
int main()
{
float n;
printf("Enter any number: ");
scanf("%f",&n);
printf("Square = %.2f\n",n*n);
printf("Cube = %.2f\n",n*n*n);
printf("Square Root = %.2f",sqrt(n));
return 0;
}

Output:

Enter any number: 9
Square = 81.00
Cube = 729.00
Square Root = 3.00

9. C Program to Calculate Gross Salary
9. Gross Salary निकालने का Program

#include<stdio.h>
int main()
{
float basic,hra,da,gross;
printf("Enter Basic Salary: ");
scanf("%f",&basic);
hra = basic*20/100;
da = basic*80/100;
gross = basic + hra + da;
printf("Gross Salary = %.2f",gross);
return 0;
}

Output:

Enter Basic Salary: 10000
Gross Salary = 20000.00

10. C Program to Convert Celsius into Fahrenheit
10. Celsius को Fahrenheit में Convert करने का Program

#include<stdio.h>
int main()
{
float c,f;
printf("Enter temperature in Celsius: ");
scanf("%f",&c);
f = (9*c/5)+32;
printf("Temperature in Fahrenheit = %.2f",f);
return 0;
}

Output:

Enter temperature in Celsius: 37
Temperature in Fahrenheit = 98.60

11. C Program to Calculate Percentage of Five Subjects
11. पाँच विषयों का Percentage निकालने का Program

#include<stdio.h>
int main()
{
float a,b,c,d,e,total,per;
printf("Enter marks of five subjects:\n");
scanf("%f%f%f%f%f",&a,&b,&c,&d,&e);
total = a+b+c+d+e;
per = total/5;
printf("Total Marks = %.2f\n",total);
printf("Percentage = %.2f",per);
return 0;
}

Output:

Enter marks of five subjects:
80
75
90
85
70
Total Marks = 400.00
Percentage = 80.00

12. C Program to Find Area of Rectangle
12. Rectangle का Area निकालने का Program

#include<stdio.h>
int main()
{
float l,b,area;
printf("Enter length and breadth:\n");
scanf("%f%f",&l,&b);
area = l*b;
printf("Area of Rectangle = %.2f",area);
return 0;
}

Output:

Enter length and breadth:
10
5
Area of Rectangle = 50.00

13. C Program to Find Area of Square
13. Square का Area निकालने का Program

#include<stdio.h>
int main()
{
float side,area;
printf("Enter side of square: ");
scanf("%f",&side);
area = side*side;
printf("Area of Square = %.2f",area);
return 0;
}

Output:

Enter side of square: 6
Area of Square = 36.00

14. C Program to Convert Days into Years, Months and Days
14. Days को Years, Months और Days में Convert करने का Program

#include<stdio.h>
int main()
{
int days,years,months,remaining;
printf("Enter total days: ");
scanf("%d",&days);
years = days/365;
remaining = days%365;
months = remaining/30;
remaining = remaining%30;
printf("Years = %d\n",years);
printf("Months = %d\n",months);
printf("Days = %d",remaining);
return 0;
}

Output:

Enter total days: 500
Years = 1
Months = 4
Days = 15

15. C Program to Find Average of Three Numbers
15. तीन संख्याओं का Average निकालने का Program

#include<stdio.h>
int main()
{
float a,b,c,avg;
printf("Enter three numbers:\n");
scanf("%f%f%f",&a,&b,&c);
avg = (a+b+c)/3;
printf("Average = %.2f",avg);
return 0;
}

Output:

Enter three numbers:
10
20
30
Average = 20.00

Sequential structure programs are the foundation of C programming. These programs help beginners understand input-output operations, variables, formulas, arithmetic operations, and program execution flow. Mastering these basic programs builds a strong base for learning advanced programming concepts such as conditional statements, loops, arrays, functions, pointers, and data structures.

Sequential structure programs C programming की नींव हैं। ये programs विद्यार्थियों को input-output operations, variables, formulas, arithmetic operations तथा program execution flow समझने में सहायता करते हैं। इन basic programs में mastery प्राप्त करने से आगे के advanced topics जैसे conditional statements, loops, arrays, functions, pointers तथा data structures सीखना आसान हो जाता है।

Next Topic:

Previous Topic: 

Back to: Unit 1: Computer Architecture and C Environment

Comments

Popular posts from this blog

C Language Topics in Hindi and English

Top High-Paying Tech Skills to Learn in 2025

Advanced C Programming Language IMP Questions for BSc/BA/BCom/BCA/BE/BTech/MSc/MCA (CS/IT) Students