Programming Languages

PROGRAM TO DETERMINE THE SIZE OF INT, CHAR, FLOAT, DOUBLE TYPE OF DATA TYPE IN COMPUTER MEMORY

/* PROGRAM TO DETERMINE THE SIZE OF INT,CHAR,FLOAT,DOUBLE TYPE OF DATA TYPE IN COMPUTER MEMORY */ #include<stdio.h> #include<conio.h> void main() { clrscr(); printf(“\n\nTHE SIZE OF INT IS : %d”,sizeof(int)); printf(“\n\nTHE SIZE OF FLOAT IS : %d”,sizeof(float)); printf(“\n\nTHE SIZE OF CHAR IS : %d”,sizeof(char)); printf(“\n\nTHE SIZE OF DOUBLE IS: %d”,sizeof(double)); getch(); }

Programming Languages

PROGRAM TO FIND PRIME NUMBERS USING FUNCTION

/* PROGRAM TO FIND PRIME NUMBERS USING FUNCTION */ #include<stdio.h> #include<conio.h> void prime(int n); void main() { int n; textcolor(69); clrscr(); printf(“\n ENTER HOW MANY PRIME NUMBERS YOU WANTS TO FIND :”); scanf(“%d”,&n); prime(n); getch(); } void prime(int n) { int x,i,j,count=0; for(i=2;i<=10000;i++) { x=0; for(j=2;j<=i/2;j++) { if(i%j==0) { x=1; break; } } if(x==0) { […]

Programming Languages

PROGRAM TO DEMONSTRATE THE DIFFERENCE BETWEEN AUTOMATIC AND STATIC VARIABLES

/* PROGRAM TO DEMONSTRATE THE DIFFERENCE BETWEEN AUTOMATIC AND STATIC VARIABLES */ #include<stdio.h> #include<conio.h> void func1(); void func2(); void main() { textcolor(90); clrscr(); printf(“\n\nFUNCTION CALLING ONE SHOWS CHANGES OF AUTO VARIABLE\n\n”); printf(“\n\nAFTER FIRST CALL OF VALUE OF I IN AUTO VARIABLE IS \n”); func1(); printf(“\n\nAFTER SECOND CALL OF VALUE OF I IN AUTO VARIABLE IS […]

Programming Languages

PROGRAM TO FIND THE FIBONACCI SERIES USING FUNCTION

/* PROGRAM TO FIND THE FIBONACCI SERIES USING FUNCTION */ #include<stdio.h> #include<conio.h> void fib(int n); void main() { int n; clrscr(); printf(“ENTER THE VALUE OF N: “); scanf(“%d”,&n); fib(n); getch(); } void fib(int n) { int a=0,b=1,i,temp,f; printf(“THE FIBONACCI SERIES IS \n\n”); printf(“%d %d “,a,b); for(i=1;i<=n-2;i++) { f=a+b; a=b; b=f; printf(” %d “,f); } }

Programming Languages

PROGRAM TO SHOW CONCEPT OF SWAPPING USING FUNCTION

/* PROGRAM TO SHOW CONCEPT OF SWAPPING USING FUNCTION */ #include<stdio.h> #include<conio.h> void swap(int a,int b); void main() { int a,b; clrscr(); printf(“ENTER THE VALUE OF A :”); scanf(“%d”,&a); printf(“ENTER THE VALUE OF B :”); scanf(“%d”,&b); swap(a,b); getch(); } void swap(int x,int y) { int temp; temp=x; x=y; y=temp; printf(“\nAFTER SWAPPING\n”); printf(“\nA :%d “,x); printf(“\nB […]

Programming Languages

PROGRAM TO COMPUTE SIMPLE INTEREST WITH ARGUMENT AND RETURN VALUE

/* PROGRAM TO COMPUTE SIMPLE INTEREST WITH ARGUMENT AND RETURN VALUE */ #include<stdio.h> #include<conio.h> float simple(int p,float r,int t); void main() { int p,t; float r,si; clrscr(); printf(“ENTER THE VALUE OF PRINCIPLE :”); scanf(“%d”,&p); printf(“ENTER THE VALUE OF RATE :”); scanf(“%f”,&r); printf(“ENTER THE VALUE OF TIME :”); scanf(“%d”,&t); si=simple(p,r,t); printf(“THE SIMPLE INTEREST IS :%f”,si); getch(); […]

Programming Languages

PROGRAM TO COMPUTE SIMPLE INTEREST WITH ARGUMENTS BUT RETURN NOTHING

/* PROGRAM TO COMPUTE SIMPLE INTEREST WITH ARGUMENTS BUT RETURN NOTHING */ #include<stdio.h> #include<conio.h> void simple(int p,float r,int t); void main() { int p,t; float r; clrscr(); printf(“ENTER THE VALUE OF PRINCIPLE :”); scanf(“%d”,&p); printf(“ENTER THE VALUE OF RATE :”); scanf(“%f”,&r); printf(“ENTER THE VALUE OF TIME :”); scanf(“%d”,&t); simple(p,r,t); getch(); } void simple(int pr,float rt,int […]