Statement:
The command given to the computer which causes the computer to carry out some action is called statement. It is of 2 types.
a)Simple Statement:
Statement consists of an expression followed by a semicolon is called simple statement. Eg: a=2;
b) Compound Statement:
A compound statement consists of several individual statements enclosed in a pair of braces { }. It provides capability for embedding statements within other statements.
Example:
{
l=2;
b=3;
area=l*b;
}
Basic Syntax of C Programming:
Q. Program for Adding two integer number:
#include<stdio.h> //header file included for standard input output
#include<conio.h> //header file included for console input output
void main() // main function
{
int num1=2; // 2 is assigned to integer variable num1
int num2=6; // 6 is assigned to integer variable num2
int sum; // variable declared to store sum
sum = num1 + num2; // num1 & num2 value is added and store to sum
printf("The Sum=%d", sum); //value of sum is displayed
getch(); // library function to hold an output screen
}
Basic Syntax of C Programming:
Q. Program for Adding two integer number:
#include<stdio.h> //header file included for standard input output
#include<conio.h> //header file included for console input output
void main() // main function
{
int num1=2; // 2 is assigned to integer variable num1
int num2=6; // 6 is assigned to integer variable num2
int sum; // variable declared to store sum
sum = num1 + num2; // num1 & num2 value is added and store to sum
printf("The Sum=%d", sum); //value of sum is displayed
getch(); // library function to hold an output screen
}
Your suggestions / query encourages more to share things like this. Feel free to comment in below box.
What ever you think about it...