Wednesday, September 21, 2011

WAP to find the size of all data types


 
// program to find the size of all data types                                 

#include<stdio.h>                                                            
#include<conio.h>                                                            
void main()                                                                   
{                                                                            
 clrscr();                                                                   
 printf("\n The number of bytes int takes is %d", sizeof(int));              
 printf("\n The number of bytes float takes is %d", sizeof(float));          
 printf("\n The number of bytes double take is%d",sizeof(double));        
 printf("\n The size of bytes char takes is %d",sizeof(char));               
 printf("\n The size of bytes long takes is %d",sizeof(long));               
 printf("\n----------------");                                               
 getch();                                                                     
}                                                                            

Output:
The number of bytes int takes is 2
The number of bytes float takes is 4
The number of bytes double takes is 8
The number of bytes char takes is 1
The number of bytes long takes is 4
____________________________
      



Sunday, September 18, 2011

How to generate sound in Turbo C..

#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
clrscr();
printf("sa...................\n");
sound(600);                      
delay(1000);
nosound();

printf("re...................\n");
sound(700);
delay(1000);
nosound();