basic c programs for beginners

basic c programs for beginners
 basic c programs for beginners 
 

basic c programs for beginners 

Basic Program in c language: A basic program can be used by every programmer know in this program.
In this post, every program can be solved you can be used every one program easily to understand. 

First Program in C Language you may try this program.

#include<stdio.h>

#include<conio.h>

int main()

{

printf("Hello World| Welcome To My First program");

}

*****OUTPUT*****

Hello World| Welcome To My First program

How to add two number in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

int a,b,c;

printf("Enter a number:");

scanf("%d",&a);

printf("Enter b number:");

scanf("%d",&b);

c=a+b;

printf("Addition of Two Number:%d",c);

}

*****OUTPUT*****

Enter a number:60
Enter b number:70
Addition of Two Number:130

How to subtraction two number in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

int a,b,c;

printf("Enter a number:");

scanf("%d",&a);

printf("Enter b number:");

scanf("%d",&b);

c=a-b;

printf("Subtraction of Two Number:%d",c);

}

*****OUTPUT*****

Enter a number:80
Enter b number:50
Subtraction of Two Number:30

How to multiplication two number in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

int a,b,c;

printf("Enter a number:");

scanf("%d",&a);

printf("Enter b number:");

scanf("%d",&b);

c=a*b;

printf("Multiplication of Two Number:%d",c);

}

*****OUTPUT*****

Enter a number:12
Enter b number:12
Multiplication of Two Number:144

How to division two number in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

int a,b,c;

printf("Enter a number:");

scanf("%d",&a);

printf("Enter b number:");

scanf("%d",&b);

c=a/b;

printf("Divison of Two Number:%d",c);

}

*****OUTPUT*****

Enter a number:120
Enter b number:6
Divison of Two Number:20

How to find five subjects average in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

float p,c,m,e,h,avg;

printf("Enter Physics Marks:");

scanf("%f",&p);

printf("Enter Chemistry Marks:");

scanf("%f",&c);

printf("Enter Maths Marks:");

scanf("%f",&m);

printf("Enter English Marks:");

scanf("%f",&e);

printf("Enter Hindi Marks:");

scanf("%f",&h);

avg=(p+c+m+e+h)/5;

printf("Average of Five Subjects Marks          Results:%f",avg);

}

*****OUTPUT*****

Enter Physics Marks:45
Enter Chemistry Marks:78
Enter Maths Marks:87
Enter English Marks:78
Enter Hindi Marks:95
Average of Five Subjects Marks Results:76.599998

How to find the area of the rectangle in the c language?

#include<stdio.h>

#include<conio.h>

int main()

{

int area,height,width;

printf("Enter Height of Reactangle:");

scanf("%d",&height);

printf("Enter Width of Rectangle:");

scanf("%d",&width);

area=height*width;

printf("Area of Rectangle:%d",area);

}

*****OUTPUT*****

Enter Height of Reactangle:22
Enter Width of Rectangle:22
Area of Rectangle:484

How to find area of square in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

int area,side;

printf("Enter Side of Square:");

scanf("%d",&side);

area=side*side;

printf("Area of Square:%d",area);

}

*****OUTPUT*****

Enter Side of Square:12
Area of Square:144


How to find area of triangle in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

float area,base,height;

printf("Enter Base:");

scanf("%f",&base);

printf("Enter Height:");

scanf("%f",&height);

area=0.5*base*height;

printf("Area of Triangle:%f",area);

}

*****OUTPUT*****

Enter Base:13
Enter Height:14
Area of Triangle:91.000000

How to find simple intrest in c language?

#include<stdio.h>

#include<conio.h>

int main()

{

float a,r,t,sim;

printf("Enter a Amount:");

scanf("%f",&a);

printf("Enter a Rate:");

scanf("%f",&r);

printf("Enter a Time:");

scanf("%f",&t);

sim=(a*r*t)/100;

printf("Simple Intrest:%f",sim);

}

*****OUTPUT*****

Enter a Amount:100000
Enter a Rate:5
Enter a Time:12
Simple Intrest:60000.000000

How to swap two number in c language method 1?

#include<stdio.h>

#include<conio.h>

int main()

{

int a=10;

int b=20;

int c;

printf("Before Swapping a=%d and b=%d\n",a,b);

c=a;

a=b;

b=c;

printf("After Swapping a=%d and b=%d",a,b);

}

*****OUTPUT*****

Before Swapping a=10 and b=20
After Swapping a=20 and b=10

How to swap two number in c language method 2?

#include<stdio.h>

#include<conio.h>

int main()

{

int a=100;

int b=200;

int c;

printf("Before Swapping a=%d and b=%d\n",a,b);

c=a+b;

a=c-a;

b=c-b;

printf("After Swapping a=%d and b=%d",a,b);


}

*****OUTPUT*****

Before Swapping a=100 and b=200
After Swapping a=200 and b=100

How to swap two number in c language method 3?

#include<stdio.h>

#include<conio.h>

int main()

{

int a=200;

int b=100;

printf("Before Swapping a=%d and b=%d\n",a,b);

a=a+b;

b=a-b;

a=a-b;

printf("After Swapping a=%d and b=%d",a,b);

}

*****OUTPUT*****

Before Swapping a=300 and b=100
After Swapping a=100 and b=300



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.