Data Types in C

 Data Types in C Programming language..

 Mainly we use  3 types of data types  in C Language

  1. Integers data type
  2. Floating point data type
  3. Character data type
Integer data types :

The positive and negative value from the range of (-32,768 to 32,767) is include by the Integer data type.

Example: int = 23; 


Floating point data types:

The data types which hold decimal numbers is Floating point data.

Example: float = 23.54;


Character data type:

Single word or single character is used inside character data type. For working with large character or sentences we use String function. The range of character data type is from -128 to 127. Above range is based of ASCII which is corresponding to char, special symbol values. Always use Quotes mark to use character.

Example: char = "a";


Let's see one example based on data types::

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
float c;
char s;
printf("Enter some character");
scanf("%s",&s);
printf("The written character is %s",s);
printf("Enter the two numbers to find division");
scanf("%d%d",&a,&b);
c=a/b;
printf("The division between %d and %d is : %d",a,b,c);
getch();
}


// Output of following code is :
   
Enter some character 
     clanguage
     The written character is clanguage
     Enter the two numbers to find division
     45 45
     The division between 45 and 45 is : 0.00

🙏🙏🙏


Comments

Post a Comment

Popular posts from this blog

About RAM

Class and object in c++