The int is a keyword which is used to declare a variable as
integer constant. It is also a data type. int data type occupy 16 bit memory
space. The range of int data type is -32,768 to 32,767 on 16 bit machine or
compiler.
The int data type can be signed or unsigned, by default it is signed. The signed int means it store both positive and negative values. The unsigned int means, it stores only positive values. The range of signed int is -32,768 to 32,767 and the range of unsigned int 0 to 65,535.
The int data type can be signed or unsigned, by default it is signed. The signed int means it store both positive and negative values. The unsigned int means, it stores only positive values. The range of signed int is -32,768 to 32,767 and the range of unsigned int 0 to 65,535.
Syntax:
int variable_name;
Ex:
int a, b;
int sum;
Program: Add two
inter number and print the result
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b;
int
sum;
printf(“Enter
Two Values : “);
scanf(“%d%d”,
&a, &b);
sum
= a + b;
printf(“Sum
= %d”,sum);
getch();
}
Output:
Enter Two Values : 10 20
Sum = 30
No comments:
Post a Comment