Mastering C Programming
7 subscribers
He friends,
Welcome to the world of C Programming, here we we'll learn 'C' programming from beginning to advance!
Download Telegram
//Divde two number

#include<stdio.h>
int main()
{
int a,b;
a= 12;
b=2;
printf("The addition is %d", a/b);
return 0;
}
//Add, input by user
#include<stdio.h>
int main()
{

int a,b;
printf("Enter two Numbers");
scanf("%d %d", &a, &b);
printf("The addition of %d and %d is %d", a, b, a+b);
return 0;
}
// Sub, input by user

#include<stdio.h>
int main()
{

int a,b;
printf("Enter two Numbers");
scanf("%d %d", &a, &b);
printf("The substraction of %d and %d is %d", a, b, a-b);
return 0;
}
//Mul, input by user

#include<stdio.h>
int main()
{

int a,b;
printf("Enter two Numbers");
scanf("%d %d", &a, &b);
printf("The multipication of %d and %d is %d", a, b, a*b);
return 0;
}
//Divide, input by user


#include<stdio.h>
int main()
{

int a,b;
printf("Enter two Numbers");
scanf("%d %d", &a, &b);
printf("The division of %d and %d is %d", a, b, a/b);
return 0;
}
//Remainder, input by user

#include<stdio.h>
int main()
{

int a,b;
printf("Enter two Numbers");
scanf("%d %d", &a, &b);
printf("The remainder of %d and %d is %d", a, b, a%b);
return 0;
}
//TO find Square root

#include<conio.h>
int main()
{
int a;
printf("Enter a Number\n");
scanf("%d",&a);
printf("The square of %d is %d", a, a*a);
}
//To find Cube root

#include<conio.h>
int main()
{
int a;
printf("Enter a Number\n");
scanf("%d",&a);
printf("The cude of %d is %d", a, a*a*a);
}
// Program to find area and circumference of circle
#include<stdio.h>
int main()
{
float radius;
printf("Enter the Radius of the circle");
scanf("%f", &radius );
printf("Area Of Circle is %f\n", 3.14*(radius*radius));
printf("Circumfurence of circle is %f", 2*3.14*radius);
return 0;
}
// Program to find area and perimeter of square
#include<stdio.h>
int main()
{
float side;
printf("Enter the size of the square\n");
scanf("%f", &side);
printf("Area of square with size %f is %f \n", side, (side*side));
printf("Perimeter of square with size %f is %f \n", side, 4*side);
return 0;
}
// Program to find area and perimeter of rectangle
#include<stdio.h>
int main()
{
float len, bred;
printf("Enter the length and breadth of a rectangle\n");
scanf("%f %f", &len, &bred);
printf("Area of rectangle with length %f and breadth %f is %f",len, bred, len*bred );
printf("Perimeter of rectangle with length %f and breadth %f is %f", len, bred, (2*(len+bred)));
return 0;
}
// Program to find average of 3 numbers
#include<stdio.h>
int main()
{
float a,b,c;
printf("Enter 3 numbers \n");
scanf("%f %f %f", &a, &b, &c);
printf("The average of %f, %f, %f, is %f", a, b,c,(a+b+c)/3);
return 0;
}
// Program to convert cm to mm

#include<stdio.h>
int main()
{
float i;
printf("Enter the value in cm\n");
scanf("%f", &i);
printf("%fmm", i*10);
return 0;
}
// Program to convert mm to cm

#include<stdio.h>
int main()
{
float i;
printf("Enter the value in mm\n");
scanf("%f", &i);
printf("%fcm", i/10);
return 0;
}
// Program to convert mm to cm

#include<stdio.h>
int main()
{
float i;
printf("Enter the value in mm\n");
scanf("%f", &i);
printf("%fcm", i/10);
return 0;
}
// Program to convert mm to inches

#include<stdio.h>
int main()
{
float i;
printf("Enter the value in mm\n");
scanf("%f", &i);
printf("%finches", i/25.4);
return 0;
}
// Program to convert kg to grams

#include<stdio.h>
int main()
{
float i;
printf("Enter the number:-\n");
scanf("%f", &i);
printf("%f grams", i*1000);
return 0;
}
// Program to convert grams to kg

#include<stdio.h>
int main()
{
float i;
printf("Enter the number in grams:-\n");
scanf("%f", &i);
printf("%f kg", i/1000);
return 0;
}
// Program to convert tons to grams

#include<stdio.h>
int main()
{
float i;
printf("Enter the number in tons:-");
scanf("%f",&i);
printf("%f", i*1000000);
return 0;
}
// Program to convert grams to tons

#include<stdio.h>
int main()
{
float i;
printf("Enter the number in grams:-");
scanf("%f",&i);
printf("%f tons", i/1000000);
return 0;
}