C programing language
C
programming is the high level programming language which has developed Denish
Riche 1981.
Write a program to add any two number:
#include <stdio.h>
#include <conio.h>
Void main ()
{
int a,b,c;
Print f{“Enter any two
numbers”};
Scan f(“%d%d”,
&a,&b);
C=a+b;
Print f (“sum=%d,”c);
getch();
}
Program to subtract multiple and divided any two numbers:
#include <stdio.h>
#include <conio.h>
Void main ()
{
int a,b,c, d, f;
Print f {“Enter any two
numbers”};
Scan f (“%d%d”,
&a,&b);
c=a-b;
d=a*b;
f=a/b;
print f (“sub=%d,”c);
print f (“mul=%d,”d);
print f (“div=%d,”f);
getch ();
}
Header file:
Header file is source
code of programming. An extension of header is (.h).
Stdio = Stander input
output
Conio= console output
and input
Main function: void main ()
It is a compulsory
function of ‘c’ programming. A programming execution is always starting from
this function.
int a, b, c =Data Type
print f =(“Enter any two
numbers”);
it is used an output
function which is used to display message on monitor.
Scan f
It is an input function
which is used to get input form keyboard.
%d mean = number (0-9)
Add 3 numbers:
#include <stdio.h>
#include <conio.h>
Void main ()
{
int x, y, z, s;
Print f {“Enter any
three numbers”};
Scan f (“%d%d%d”,
&x,&y&z);
s=x+y+z;
print f (“sum of three
numbers = %d”, s);
getch ();
}
Program to find the area of rectangle:
#include <stdio.h>
#include <conio.h>
Void main ()
{
Int A, L, B;
Print f {“Enter length
of rectangle”};
Scan f (“%d”, &L);
Print f {“Enter breth of
rectangle”};
Scan f (“%d”, &B);
A=L*B;
print f (“Area=%d,” A);
getch ();
}
Program to find the area of triangle:
#include <stdio.h>
#include <conio.h>
Void main ()
{
Int a, b, c, s, area;
Print f {“Enter value of
three sides”};
Scan f (“%f%f%f”,
&a, &b, &c);
S=(a+b+c)/2;
Area=
(s*(s-a)*(s-b)*(s-c));
Area=pow (area, s);
Print f {“Area=%f”,
Area};
getch ();
}
Not: %f= decimal value
How to find multiplication table in c programming with given number?
Multiplication table
#include<stdio.h>
#include<conio.h>
Void main ()
{
Int n, p, p;
Print f (“Enter number”);
Scan f (“%d”, &n);
For(i=1; i<=10; i++)
{
P=n*i;
Print f (“%d”, p);
}
getch();
}
0 comments:
Post a Comment