Saturday, 11 December 2010

Write a c program to demonstrate all basic data types available in c.

Write a c program to demonstrate all basic data types available in c.
#include<stdio.h>
#include<conio.h>
void main()
{
  short int s=128;
  int i=1;
  signed int a=6;
  signed int e=-6;
  long l=1234567890;
  char ch='a';
  float b=1.123456789f;
  double d=3.12546789123456789;
  clrscr();
  printf("short data type s=%d\n",s);
  printf("unsigned int data type a=%d\n",a);
  printf("signed int data type e=%d\n",e);
  printf("integer data type i=%d\n",i);
  printf("long data type %ld\n=",l);
  printf("char data type ch=%c\n",ch);
  printf("float data type b=%.2f\n",b);
  printf("double data type d=%Ld\n",d);
  getch();

No comments:

Post a Comment