16. Input from User –
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b,c;
clrscr();
printf(“Enter 1st Numbern”);
scanf(“%d”,&a);
printf(“Enter 2nd Numbern”);
scanf(“%d”, &b);
printf(“Value of 1st No = %dn”,a);
printf(“value of 2nd No = %dn”,b);
c=a+b;
printf(“Sum of two no = %dn”, c);
getch();
}
19. Increment & Decrement Operator
Increment & Decrement Operator is two type
i. Pre Increment / Decrement Operator -
Increase/ Decrease the variable values then print e.g. ++a / --a
ii. Post Increment / Decrement Operator –
Print the variable values then Increase / Decrease e.g. a++/a--
#include<stdio.h>
#include<conio.h>
void main()
{
int a=5;
clrscr();
printf(“Value of a in 1st Step = %dn”,a);
printf(“Value of a in 2nd Step = %dn”,++a);
printf(“Value of a in 3rd Step = %dn”,a);
printf(“Value of a in 4th Step = %dn”,a++);
printf(“value of a in 5th Step = %dn”,a);
getch();
}
27. Syntax Error
EXTRA
It occurs when grammatical error has found.
EX:-
int a
Here semicolon sign missing so it is related
through ‘C’ program grammar So, Syntax error occur.
28. Symantic Error
This type of error occur when statement
are not meaningful.
EX:-
a+b = c;
It is wrong assignment here
statement are not meaningful here should
be c = a+b.
EXTRA
29. Type Error
This type of error occur when datatype
mismatch.
Ex:- int a = 3.5;
char c = 4;
EXTRA
Here a is integer variable so it can
not hold floating value and in second line c is
the character variable and it can not integer
value.
30. Logical error
This type of error occur when your statement
is logically incorrect.
Ex:-
int i = 1;
while(i>=10) /*value of i never be greater than 10*/
{
printf(“%dn”,i);
}
EXTRA
31. Run time Error
This type of error occur during run time or
execution time.
Ex:- You are trying to open a file which
does not exist it will occur run time error.
Its another example is , you are making
Infinite loop.(endless loop).
EXTRA