Skip to main content

Posts

Showing posts with the label C Language Tutorial

ads1

C language tutorial

Write a C program to enter radius of a circle and find its diameter, circumference and area. /* diameter = 2 r circumference = 2 pi r Area = pi r * r */ Static #include<stdio.h> #include<conio.h> void main() {     clrscr();     float pi = 3.14,dia,cir,area;     int r = 10;     dia = 2 * r;     cir = 2 * pi * r;     area = pi * r * r;     printf("\nThe area of circle :- %f",area);     printf("\nThe diameter of a circle :- %f",dia);     printf("\nThe circumference of a circle :- %f",cir); getch(); }    Output :-  Dynamic   #include<stdio.h> #include<conio.h> void main() {     clrscr();     float pi = 3.14,dia,cir,area;     int r;      printf("Enter the radius :- ");     scanf("%d",&r);     dia = 2 * r;     cir = 2 * pi * r;     area = pi * r * r;     printf("\nThe area of circle :- %f",area);     printf("\nThe diameter of a circle :- %f",dia);     printf("\nThe circumference of a circl

C language tutorial

 Write a C program to enter length and breadth of a rectangle and find its area.   #include<stdio.h> #include<conio.h> void main() {     clrscr();     int area,length=10,width=5;     area = length*width;     printf("The area of a rectangle is :- %d",area); getch(); } Output :-  #include<stdio.h> #include<conio.h> void main()   {     clrscr();     int length,breadth,area;     printf("Enter the length and breadth of rectangle :-");     scanf("%d %d",&length,&breadth);     area = length * breadth;     printf("The area of rectangle is :- %d",area); getch(); } Output :-                   

C language Tutorial

Write a C program to enter length and breadth of a rectangle and find its perimeter.   Static program #include<stdio.h> #include<conio.h> void main() {     clrscr();     int length=10,width=5,per;     per = 2*(length+width);     printf("The perimenter of rectangle is :- %d ",per); getch(); }  Output :-  Dynamic Program  #include<stdio.h> #include<conio.h> void main() {     clrscr();     int length,width,per;     printf("Enter the length and breadth of a rectngle :-");     scanf("%d %d",&length,&width);     per = 2*(length+width);     printf("The perimeter of rectangle is :- %d",per); getch(); }   Output :-       

C language Tutorial

 Write a C program to enter two numbers and perform all arithmetic operations.   Static Program   #include<stdio.h> #include<conio.h> void main() {     clrscr();     int a=15, b=13,sum,sub,mul,div,mod;     sum =a+b;     sub = a-b;     mul = a*b;     div = a/b;     mod = a%b;     printf("\nThe sum of 2 number is :- %d",sum);     printf("\nThe sub of 2 number is :- %d",sub);     printf("\nThe mul of 2 number is :- %d",mul);     printf("\nThe div of 2 number is :- %d",div);     printf("\nThe mod of 2 number is :- %d",mod); getch(); } Output :-    Dynamic Program  #include<stdio.h> #include<conio.h> void main() {     clrscr();     int a,b,sum,sub,mul,div,mod;     printf("Enter the first number :-");     scanf("%d",&a);     printf("Enter thr second number :-");     scanf("%d",&b);     sum = a+b;     sub = a-b;     mul = a*b;     div = a/b;     mod = a%b;     printf("

C Language Tutorial

C Language    Write a C program to enter two numbers and find their sum.   Static Program #include<stdio.h> #include<conio.h> void main() {     clrscr();     int a =10,b=20,sum;     sum = a+b;     printf("The sum of two number is :- %d",sum); getch(); } Output :-  Dynamic Program   #include<stdio.h> #include<conio.h> void main() {     clrscr();     int a,b,sum;     printf("Enter the first number :- ");     scanf("%d",&a);     printf("Enter the second number :- ");     scanf("%d",&b);     sum = a+b;     printf("The sum of two number is :- %d",sum);     getch(); }    Output :-     

ads2