Programming in C

*** NB: This programming code is extracted from Personal Software Plus Database Archieve and this is not serialized in any order.

92.Write a program
#include<stdio.h>
struct empo
{
int empo;
char e[6];
int cs;
};
void main
{
int i;
struct empo *e[2];
clrscr();
for(i=0;i<2;i++)
{
printf(“Enter emopno,name, sal”);
scanf(“%d%s%d”,&e[i]->empo,&e[i]->en,&e[i]->es);
}
clrscr();
for(i=0;i<2;i++)
{
printf(“%d%s%d\n”,e[i]->empo,e[i]->en,e[i]->es);
}
}

C Programming Archive
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
93.Write a program
#include<stdio.h>
main()
{
int a, b, *p, *q;
clrscr();
printf(“Enter values for a and b \n”);
scanf(“%d%d”,&a,&b);
p=&a;
q=&b;
printf(“The value of a is %d address is %x”,a,p);
printf(“The value of b is %d address is %x”,b,q);
return;
}

C Programming Archive
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
20.Write a program to display the even number less than the accepted value n.
#include<stdio.h>
void main()
{
int  i n;
clrscr();
printf(“Enter the Value for n:”);
scanf(“%d”,&n);
for(i=2;i<=n;i+=2)
{
printf(“%d\n”,i)
}
getch();
}

C Programming Archive- even number less than the accepted value.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
38 Write a program to find the minimum number of given numbers using arary.
#include<stdio.h>
void main()
{
int  a[20], i,n,min;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values \n”,n);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
min=a[0];
for(i=1;i<n;i++)
if(a[i] < min)
min=a[i];
printf(“The Minimum value of the given numbers=%d”,min);
getch();
}

C Programming Archive- minimum number of given numbers using arary.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
88.Write a program to find the minimum of given ‘n’ element using an indirection operator(*)
#include<stdio.h>
void main()
{
int a[20], i, *p, min, n;
clrscr();
printf(“Enter how many values \n”);
scanf(“%d”,&n);
printf(“Enter the value into the array\n”);
for(i=0;i<n;i++)
scanf(:%d”,&a[i]);
p=a;
min=*p;
for(i=1;i<n;i++)
{
++p;
if(min > *p)
min=*p;
}
printf(“Minimum value =%d”,min);
getch();
}
a[0]    a[1]    a[2]    a[3]
5    10    1    15

1000            1002            1004            1006
Here   min=*p=1
==========================

C Programming Archive- minimum of given ‘n’ element using an indirection operator(*).
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
13. Write a program to check the given number Pallendram or not.
#include<stdio.h>
void main()
{
long int no, rno=0, r, t;
clrscr();
printf(“Enter any number”);
scanf(“%ld”,&no);
t=no;
while(no!=0)
{
r=no%10l
no=no/10;
rno=rno*10+r;
}
if(t== rno)
printf(“This is a pallendram number \n”);
else
printf(“This is not a pallendram number \n”);
getch();
}

C Programming Archive- Pallendram or not.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
70. Write a program to accept ROL number and NAME of the students and store them in the file and display them back on the string.
#include<stdio.h>
main()
{
FILE *fp;
char *name; /* Character array with a pointer variable declaration */
int rno;
clrscr();
printf(“Enter the text and finally press ^z\n”);
fp=fopen(“STUD.DAT”,”w”);
printf(“Enter the roll no and name and finally press ^d”);
while((scanf(“%d%s”,^rno,name)) !=EOF)
fprintf(fp,”%d%s”,rno,name);
fclose(fp);
fp=fopen(“STUD.DAT”,”r”);
printf(“The record from the file\n”);
while((fscanf(fp,”%d%s”,rno, name != EOF)
printf(“rno=%d\n, name=%\n”,rno,name);
fclose(fp);
getch();
}

C Programming Archive-accept ROL number and NAME of the students and store them in the file and display them back on the string.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
82. Write a program to find the area and the parameter of a circle where
Area=pr2, (p means-Pi)
Parameter p = 2pr(p means-Pi)
#include<stdio.h>
main()
{
int r;
float a, p;
clrscr();
void apcircle(int tr, float *ta, float *tp)
printf(“Enter radius of circle \n”);
scanf(“%d”,&r);
apcircle(r,&a,&p)
printf(“Area=%f\n”,a);
printf(“Parameter=%f\n”,p);
getch();
}
void apcircle(int tr, float *ta, float *fp)
{
*ta=3.14*r*r);
*tp=2*3.14*r;
}
C Programming Archive-area and the parameter of a circle.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
36 Write a program to check whether the given number is armstrong number or not
#include<stdio.h>
void main()
{
int n,r,t,sum=0;
clrscr();
printf(“Enter any number”):
scanf(“%d”,&n);
t=n;
while(n != 0)
{
r=n%10;
sum+= r*r*r;
n=n/10; /* or n/=10;*/
}
if (sum==t)
printf(“Ths is a Armstrong Number”):
else
printf(“Ths is not mstrong Number”):
getch();
}

C Programming Archive-armstrong number.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
37 Write a program to accept ‘n’ value in to the array an display them
#include<stdio.h>
void main()
{
int a[20], n,i;
clrscr();
printf(“Enter how many values”);
scanf(“%d”,&n);
printf(“Give %d values \n”,n);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
printf(“The values from the array”);
for(i=0;i<n;i++)
printf(“%d\n”,a[i]);
getch();
}

C Programming Archive-array- accept ‘n’ value in to the array an display them.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^

47 Write a program to arrange the character of a given string Alphabetical order or ascending order.
#include<stdio.h>
#include<string.h>
#include<ctype.h>
void main()
{
char s[100], temp;
int len,i,j;
clrscr();
printf(“Enter any string \n”);
gets(s);
len=strlen(s);
for(i=0;i<len-1;i++)
for(j=i+1;j<len;j++)
if(To Upper(s[i] > to upper(s[i]))
{
temp=s[i];
s[i]=s[j];
s[j]=temp;
}
printf(“The sorted string \n”);
puts(s);
getch();
}

C Programming Archive-ascending order.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
43 Write a program to search for a given element in the array of  n elements using Binary search
#include<stdio.h>
void main()
{
int  a[30], i,n, flag=0, key,top,bott,mid;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values in the array in ascending order \n”,n);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
printf(“Enter Search elements\n”):
scanf(“%d”,&key);
top=0;
bott=n;
while(top <=bott)
{
mid=(top + bott) / 2;
if(key== a[mid])
{
flag=1;
break;
elseif(key <a[mid])
bott=mid-1;
elseif(key >a[mid])
top=mid+1;
}
if (flag==1)
printf(“Element is found at location %d”,mid+1);
else
printf(“Element is not found”);
getch();
}

C Programming Archive-Binary search
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
44 Write a program to sort given n element into ascending order using bubble sort
#include<stdio.h>
void main()
{
int  a[30], i, j, n, temp;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values in the array in ascending order \n”,n);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
}
for(i=0;i<n-1;i++)
for(j=0;j<n-i-1;j++)
if(a[j] >a[j+1])
{
temp=a[j];
a[j]= a[j+1]
a[j+1]=temp;
}
printf(“The sorted elements are”);
for(i=0;i<n;i++)
printf(“%d\n”,a[i]);
getch();
}

C Programming Archive-bubble sort.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
69. Write a program to concatenate the given text files into a new file.
#include<stdio.h>
#include<conio.h>
main()
{
FILE *fp, *fq,*fr;
char x;
clrscr();
printf(“Enter any text and finally press ^d or ^z\n”);
fp=fopen(“SOHAIl1.TXT,”w”);
while((x=getchar()) !=EOF)
putc(x,fp);
fclose(fp); /* flushall(); */
printf(“Enter any text and finally press ^d or ^z\n”);
fp=fopen(“SOHAIl2.TXT”,”w”);
while((x=getchar()) != EOF)
putc(p,fq);
fclose(fq);
/* Concatenating the sohail1.txt and sohail2.txt into sohail3.txt */
fr=fopen(“SOHAIL3.TXT”,”a”);
fp=fopen(“SOHAIL1.TXT”,”r”);
while((x==getc(fp)) != EOF)
putc(x,fr);
fclose(fp)l
fq=fopen(“SOHAIL2.TXT”,”r”);
while=((x=getc(fq)) != EOF)
putc(x,fr);
fclose(fq);
fclose(fr);
/* Displaying the contain from the concatenating file SOHAIL3.TXT */
fr=fopen(“SOHAIL3.TXT”,”r”);
while((x=getc(fr)) != EOF)
printf(“%c”,x);
fclose(fr)l
getch();
}
<After Typing, go to next line and press ^z>
C Programming Archive-concatenate the given text files into a new file.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
64.Write a program to concatenate the given two string into another string.
#include<stdio.h>
#include<string.h>
void main()
char s1[50],s2[50],s3[100];
clrscr();
printf(“Enter the first string\n”);
gets(s1);
printf(“Enter the Second string\n”);
gets(s2);
strcopy(s3,s1);
strcat(s3,s2);
getch();
}
#################################
{
char temp[20];
int i,j;
for(i=0;i<n-1;i++)
for(j=0;j<n-i;j++)
if(strcmp(name[j],name[i+1]) > ))
{
strcpy(temp, name[j]);
strcpy(name[j],name[j+1]);
strcpy(name[j+1],tmp)
}
return;
}

C Programming Archive-concatenate the given two string into another string.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
66. Write a program to concatenate the given two string without using strcat function.
#include<stdio.h>
#include<string.h>
void main()
{
char s1[100],s2[100],s3[200]
int p,q,r,i,j,k;
clrscr();
printf(“Enter the first string\n”);
gets(s1);
printf(“Enter the Second string\n”);
gets(s2);
p=strlen(s1);
q=strlen(s2);
i=0;
k=0;
while(s[i] != ”)
{
s3[k]=s1[i];
i++;
k++;
}
j=0;
while(s2[j] != ”)
{
s3[k]=s2[j];
j++;
k++;
}
s3[k]=”;
printf(“The concatenation of two string \n”);
puts(s3);
getch();
}
Another Method:
#include<stdio.h>
#include<string.h>
void main()
{
char s1[100],s2[100],s3[200]
int p,q,r,i,j,k;
clrscr();
printf(“Enter the first string\n”);
gets(s1);
printf(“Enter the Second string\n”);
gets(s2);
p=strlen(s1);
q=strlen(s2);
i=0;
k=0;
for(i=0;i<p;i++)
s3[k++]=s1[i];
for(j=0;j<q;j++)
s3[k++]=s2[j];
s3[k]=”;
printf(“The concatenation of two string \n”);
puts(s3);
getch();
}

C Programming Archive-concatenate the given two string without using strcat function.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
68. Write a program to copy the contain of one file to another file.
#include<stdio.h>
main()
{
FILE *fp, *fpt;
char p;
clrscr();
printf(“Enter the text and finally press ^z\n”);
fp=fopen(“ALAM.DAT”,”w”);
while((p=getchar()) !=EOF)
putc(p,fp);
fclose(fp);
fpt=fopen(“TEMP.DAT”,”w”);
fp=fopen(“ALAM.DAT”,”r”);
while((p=getc(fp)) != EOF)
putc(p,fpt);
fclose(fp);
fclose(fpt);
getch();
}

C Programming Archive-copy the contain of one file to another file.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
73. Write a program to count the number of character in the given text file(eliminate the blank).
#include<stdio.h>
#include<conio.h>
main()
{
FILE *fp;
char x;
int nc=0;
clrscr();
printf(“Enter the text and finally press ^d\n”);
fp=fopen(“BANGLA.DAT”,”w”);
while((x=getchar()) !=EOF)
putc(x,fp);
fclose(fp);
fp=fopen(“BANGLA.DAT”,”r”);
while((x=getc(fp)) != EOF)
{
if(x != ‘ ‘)
++nc;
}
fclose(fp);
printf(“The number of character =%d\n”,nc);
getch();
}

C Programming Archive-count the number of character in the given text .
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
72. Write a program to count the number of character, number of words and number of lines in the given text file.
#include<stdio.h>
#include<conio.h>
main()
{
FILE *fp;
char x,p=’a’;
int nw,nc, nl;
clrscr();
nw=nc=nl=0;
printf(“Enter the text and finally press ^d\n”);
fp=fopen(“MAS.DAT”,”w”);
while((x=getchar()) !=EOF)
putc(x,fp);
fclose(fp);
fp=fopen(“MAS.DAT”,”r”);
while((x=getc(fp)) != EOF)
{
++nc;
if(x!=’ ‘) && (p == ‘ ‘)) || (x == ‘\n’)
++nw;
if(x == ‘\n’)
++nl;
p=x;
}
fclose(fp);
printf(“The number of character =%d\n”,nc);
printf(“The number of words =%d\n”,nw+1);
printf(“The number of line =%d\n”,nl+1);
getch();
}

C Programming Archive-count the number of character, number of words and number of lines in the given text file.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
35 Write a program to except n numbers and count the number of positive numbers(+ve) and negatice number(-ve) and display them
#include<stdio.h>
void main()
{
int  n, pc=0, nc=0, num, i;
clrscr();
printf(“Enter required number of numbers”):
scanf(“%d”,&n);
for(i=0,i<n,i++)
{
printf(“Enter the number”):
scanf(“%d”,&num);
if(num<0)
nc++;
if(num>0)
pc++;
}
printf(“Numbers of positive(+ve) number =%d”,nc);
printf(“Numbers of Negative(+ve) number =%d”,pc);
getch();
}

C Programming Archive-count the number of positive numbers(+ve) and negatice number(-ve) and display them.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
48 .Write a program to count the number, characters, numbers of vowels, number of words, and number of blanks in the given string.
#include<stdio.h>
#include<string.h>
#include<ctype.h>
void main()
{
char s[100];
int len,i,nw,nc,nb,nv;
clrscr();
printf(“Enter any string \n”);
gets(s);
len=strlen(s);
nc=nw=nb=nv=0
for(i=0;i<len;i++)
{
if (is alpha(s[i]))
nc++;
if( s[i] == ‘ ‘) /* or if (s[i] == 32) nb++; */
nb++;
if((s[i] == ‘a’)|| (s[i] == ‘A’)|| (s[i] == ‘e’)|| (s[i] == ‘E’)|| (s[i] == ‘i’)|| (s[i] == ‘I’)|| (s[i] == ‘o’)|| (s[i] == ‘O’)|| (s[i] == ‘u’)|| (s[i] == ‘U’))
nv++
}
printf(“\nNumber of characters are =%d”,nc);
printf(“\nNumber of blanks are =%d”,nb);
printf(“\nNumber of vowels are =%d”,nv);
printf(“\nNumber of words are =%d”,nw);
/* Code is to be included for word counting */
getch();
}

C Programming Archive-count the number, characters, numbers of vowels, number of words, and number of blanks in the given string.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
67. Write a program to store text into the data file and also display the text from the data file on the data file on the screen.
#include<stdio.h>
main()
{
FILE *fp;
char x;
clrscr();
printf(“Enter the text and finally press ^z\n”);
fp=fopen(“MAHFUJ.DAT”,”w”);
while((x=getchar()) !=EOF)
putc(x,fp);
fclose(fp);
printf(“Reading text from the file and displaying back on to the screen\n”);
fp=fopen(“MAHFUJ.DAT”,”r”);
while((x=getc(fp)) != EOF)
printf(“%c”,x);
fclose(fp);
getch();
}

C Programming Archive-Data file- store text into the data file and also display the text from the data file on the data file on the screen.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
6.Write a program to display the value after division in float and integer type variable.
#include<stdio.h>
void main()
{
int a,b,q;
float t;
clrscr();
printf(“Enter two values”);
scanf(“%d%d”,&a,&b);
q=a/b;
t=a/b;
printf(“Value of q is %d”,q);
printf(“Value of t is%f”,t);
getch();
}

C Programming Archive-display the value after division in float and integer type variable.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
18. Write a program to display the value starting from 0 to  n using for Loop.
Method-1
#include<stdio.h>
void main()
{
int i, n;
clrscr();
printf(“Enter the maximum limit:”);
scanf(“%d”,&n);
for(i=0;i<=n;i++)
{
printf(“%d\n”,i);
}
getch();
}
Method-2
#include<stdio.h>
void main()
{
int n,i;
clrscr();
printf(“Enter the maximum limit:”);
scanf(“%d”,&n);
i=0;
for(;;)
{
if(i<n)
break;
else
{
printf(“%d\n”,i);
i++;
}
}
getch();
}

C Programming Archive-display the value starting from 0 to  n using for Loop.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
19.Write a program to display first 10 even numbers.
#include<stdio.h>
void main()
{
int i,c=1;
clrscr();
printf(“First 10 even numbers”);
for(i=2;i<=10;i+=2)
{
printf(“%d\n”,i);
c++;
}
getch();
}

C Programming Archive-Even numbers-display first 10 even numbers.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
58.Write a program to find the factorial of a given number using function
#include<stdio.h>
void main()
{
longint n,t;
clrscr();
longint fact(longint x); /* prototype of function*/
printf(“Enter any value”);
scanf(“%ld”,&n);
t=fact(n);
printf(“Factorial=%ld”,t);
getch();
}
longint fact(longint x)
{
longint i, f=1;
for(i=0;i<=x;i++)
f*=i;
return(f);
}

C Programming Archive-factorial of a given number using function.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
59.Write a program to find the factorial of a given number using void function
#include<stdio.h>
main()
{
longint n,t;
clrscr();
void fact(longint x); /* prototype of function*/
printf(“Enter any value”);
scanf(“%ld”,&n);
fact(n);
getch();
}
void fact(longint x)
{
longint i, f=1;
for(i=1;i<=x;i++)
f *=i;
printf(“Factorial=%ld”,f);
return;
}

C Programming Archive-factorial of a given number using void function.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
25. Write a program to find the factorial of a given number.
#include<stdio.h>
void main()
{
int  i, n, f=1;
clrscr();
printf(“Enter the Value for n:”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
f  *= i;
printf(“Factorial=%d\n”,f)
}
getch();
}

C Programming Archive-factorial of a given number.

~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
32 Write a program to find the factorial of given number using do while loop
#include<stdio.h>
void main()
{
int n, f=1, i=1;
clrscr();
printf(“Enter any number”):
scanf(“%d”,&n);
do
f*=i;
i++;
while(i<=n);
printf(“Factorial of %d”=%f”,n,f);
getch();
}

C Programming Archive-factorial of given number using do while loop.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~34 Write a program to find the factorial of given number using do while loop
#include<stdio.h>
void main()
{
int n, f=1, i=1;
clrscr();
printf(“Enter any  number”):
scanf(“%d”,&n);
do
f *=i;
i++;
while(i<=n)
printf(“Factorial is %d”,f);
getch();
}

C Programming Archive-factorial of given number using do while loop.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
60.Write a program to generate n fibonacci number using void function
#include<stdio.h>
main()
{
int n;
clrscr();
void fib(int x) /*Proto type */
printf(“Enter any value”);
scanf(“%d”,&n);
fib(n);
getch();
}
void fib(int x)
{
long int f=-1;s=1;t,i;
printf(“Fibonacci number\n”);
for(i=1;i<=x;i++)
{
t=f+s;
printf(“%d\n”,t);
f=s;
s=t;
}
return;
}

C Programming Archive-fibonacci number using void function.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

28. Write a program to display fibono-cci number
#include<stdio.h>
void main()
{
longint f=0,s=1,t;
int n,i;
clrscr();
printf(“Enter number of  required fibonocci number”);
scanf(“%d”,&n);
printf(“Fibonocci Series”):
printf(“%ld\n %ld\n”,f,s);
for(i=1;i<=n-2;i++)
{
t=f+s;
printf(“%ld\n”,t);
f=s;
s=t;
}
getch();
}

C Programming Archive-fibono-cci number
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
31 Write a program to generate n fibonocci prime using while loop.
#include<stdio.h>
void main()
{
int f=-1;s=1, mid, flag, n, count,fact,t;
clrscr();
printf(“Enter the number of fibonocci while prime required \n”);
scanf(“%d”,&n);
count=1;
while(count<=n)
{
t=f+s;
flag=1
mid=t/2
for(i=2;i<=mid;i++)
if((t%i)== 0)
{
flag=0;
break;
}
if((flag ==1) && (t !=2))
{
printf(“%d\n”,t);
count++;
}
f=s;
s=t;
}
getch();
}

C Programming Archive-fibonocci prime using while loop.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
30. Write a program to generate fibonocci prime.
#include<stdio.h>
void main()
{
int f=0;s=1,t, mid, flag, c, count;
clrscr();
printf(“Enter the value for n \n”);
scanf(“%d”,&n);
printf(“Fibonocci Prime \n”);
printf(“%d \n”,s);
count=1;
for(;;)
{
t=f+s;
flag=1
mid=t/2
for(i=2;i<=mid;i++)
if((t%i)== 0)
{
flag=0;
break;
}
if((flag ==1) && (t !=2))
{
printf(“%d\n”,t);
count++;
}
if(count >=n)
break;
f=s;
s=t;
}
getch();
}

C Programming Archive-fibonocci prime.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
91.Write a program
#include<stdio.h>
struct emp
{
int empno;
char ename[10];
int salary;
}e;
main()
{
FILE *fp;
char ans=’y’
fp=fopen(“emp.dat”,”w”); /*Only “a” at the time of adding…(or appending?)*/
clrscr();
while(ans==’y’)
{
printf(“Enter employee number:”);
scanf(“%d”,&e.empno);
printf(“Enter employee name:”);
scanf(“%d”,e.ename);
printf(“Enter employee name:”);
scanf(“%d”,e.empname);
printf(“Enter employee Salary:”);
scanf(“%d”,e.salary);
printf(fp,”Employee number : %d\n”,empno);
printf(fp,”Employee name : %d\n”,ename);
printf(fp,”Employee salary :\n”);
fprintf(fp,”\n”);
printf(“WIsh to continue y/n”);
fflush(stdin)
scanf(“%c”,&ans);
}
return 0;
}
C Programming Archive-General-Data File.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
89.Press out the following program
#include< alloc.h >
void main()
{
int n,avg,i, *p, sum=0;
clrscr();
printf(“Enter The num of Students \n”);
scanf(“%d”,&n);
p=(int *) malloc (n*2);
if(p==null)
{
printf(“Memory allocation Unsuccessful\n”);
exit();
}
for(i=0;i<n;i++)
scanf(“%d”,(p+i));
for(i=0;i<n;i++)
sum=sum+*(p+i);
avg=sum/n;
printf(“Average =%d”,avg);
getch();
}

C Programming Archive-General-Press out the following program.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
C Programming!!!
Prepared By Mahfuj Alam

************************************************************************
Programming Solve:
==============================
(1)    Write a program to find the greater of two numbers.
FIrst Method:

#include<stdio.h>
void main()
{
int a, b, max;
clrscr();
printf(“Enter two values”);
scanf(“%d%d”,&a,&);
if(a>b)
max=a;
else
max=b;
printf(“The maximum value is %d”,max);
getch();
}
Second Method:
#include<stdio.h>
void main()
{
int a, b;
clrscr();
printf(“Enter two values”);
scanf(“%d%d”,&a,&);
if(a>b)
printf(“The maximum value is%d”,a);
else
printf(“The maximum value is%d”,b);
getch();
}

C Programming Archive-greater of two numbers
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
57.Write a program to Check whether the given square matrix in identity or not.
#include<stdio.h>
void main()
{
int a[5][5],b[5][5],i,j,m,flag1=1, flag2=1;
clrscr();
printf(“Enter the number of rows and columns of the matrix \n”);
scanf(“%d”,&m);
printf(“Enter %d value into matrix \n”,m*m);
for(i=0;i<m;i++)
for(j=0;j<m;j++)
scanf(“%d”,&a[i][j]);
printf(“The Matrix from of given element\n”);
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
printf(“%d”,a[i][j]);
printf(“\n”);
}
for(i=0;i<m;i++)
for(j=0;j<m;j++)
if ((i==j) && (a[i][j] != 1))
{
flag1=0;
break;
}
if ((i!=j) && (a[i][j] != 0))
{
flag2=0;
break;
}

if((flag1==1) && (flag2==1))
printf(“This is an Identitiy Matrix\n”);
else
printf(“This is not an Identitiy Matrix \n”);
getch();
}

C Programming Archive-Identitiy Matrix.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
52.Write a program to find the difference of given two matrixes of order Amxn and Bixp
#include<stdio.h>
void main()
{
int a[5][5],b[5][5],c[5][5],i,j,m,n,l,p;
clrscr();
printf(“Enter the order of matrix A\n”);
scanf(“%d%d”,&m,&n);
printf(“Enter the order of matrix B\n”);
scanf(“%d%d”,&l,&p);
if((m==l) &&(n==p))
printf(“Enter %d value into matrix A\n”,m*n);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf(“%d”,&a[i][j]);
printf(“Enter %d value into matrix B\N”,l*p);
for(i=0;i<l;i++)
for(j=0;j<p;j++)
scanf(“%d”,&b[i][j]);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
c[i][j]=a[i][j]-b[i][j];
printf(“The difference of the given two matrix \n”);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf(“%5d””,c[i][j]);
printf(“\n”);
}
}
else
printf(“Matrix difference not possible”);
getch();
}

C Programming Archive-ifference of given two matrixes of order Amxn and Bixp.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

46 Write a program to sort the given n element into using Insersion sort
#include<stdio.h>
void main()
{
int  a[30],temp,ptr,k,n,i;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values into the array \n”,n);
for(i=1;i<=n;i++)
{
scanf(“%d”,&a[i]);
a[o]=-9999
}
for(k=2;k<=n;k++)
{
temp=a[k];
ptr= k-1

while(temp<a[ptr])
{
a[ptr+1]=a[ptr];
ptr=ptr-1;
}
a[ptr+1]=temp;
}
printf(“The sorted elements are”);
for(i=1;i<=n;i++)
printf(“%d\n”,a[i]);
getch();
}

C Programming Archive-Insersion sort
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
42 Write a program to search for a particular element in the array of ” elements using linear search
#include<stdio.h>
void main()
{
int  a[30], i,n, flag=0, key;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values in the array \n”,n);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
printf(“Enter Search elements\n”):
scanf(“%d”,&key);
for(i=0;i<n;i++)
if(key== a[i])
{
flag=1;
break;
}
if (flag==1)
printf(“Element is found at location %d”,i+1);
else
printf(“Element is not found”);
getch();
}

C Programming Archive-linear search
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
50 .Write a program to accept the matrix of order MXN and display the element in the form of matrix
#include<stdio.h>
void main()
{
int a[20][10],i,j,m,n;
clrscr();
printf(“Enter the number of rows”);
scanf(“%d”,&m);
printf(“Enter the number of Columns”);
scanf(“%d”,&n);
printf(“Enter %d element into matrix\n”,mxn);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf(“%d”,&a[i][j]);
printf(“The elements in the form of matrix\n”);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf(“%d”,&a[i][j]);
printf(“The elements in the form of matrix\n”);
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
printf(“%5d”,a[i][j]);
printf(“\n”);
}
getch();
}

C Programming Archive-matrix of order MXN and display the element in the form of matrix.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
15. Write a program to find the maximum of given n numbers.
#include<stdio.h>
void main()
{
int n.c.num,max;
clrscr();

printf(“Enter how many numbers”);
scanf(“%d”,&n);
printf(“Enter the first number”);
scanf(“%d”,&num);
max=num;
c=1;
while(c<n)
{
c++;
printf(“Enter new number:);
scanf(“%d”<&num);
if (num>max)
max=num;
}
printf(“The maximum numbers of the given numbers is %d\n”,max);
getch();
}

C Programming Archive-maximum of given n numbers.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
2.Write a program to find the maximum of given three numbers.
First Method:

#includde<stdio.h>
void main()
{
int a,b,c,max:
clrscr();
printf(“Enter the three values”);
scanf(“%d%d%d”,&a,&b,&c);
if((a>b) && (a>c)0
max=a;
elseif (b>c)
max=b;
else
max=c;
printf(“The greatest number is %d”,max);
getch();
Second Method:
#includde<stdio.h>
void main()
{
int a,b,c:
clrscr();
printf(“Enter the three values”);
scanf(“%d%d%d”,&a,&b,&c);
if((a>b) && (a>c)
printf(“The greatest number is %d”,a);
elseif (b>c)
printf(“The greatest number is %d”,b);
else
printf(“The greatest number is %d”,c);
getch();
C Programming Archive-maximum of given three numbers
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
41 Write a program to find the mean and variance and standard deviation of given numbers.
Mean=?xi/n = (x1+x2+x3……..xi)/n [?-SUMMATION]
Variance=?(xi-m)2/n
Standard division= vVariance

#include<stdio.h>
#include<math.h>
void main()
{
int  a[20], i,n,sum=0;
float m,v,vsum=0,sd;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values in the array \n”,n);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
sum+=a[i];
}
m=sum/n;
for(i=0;i<n;i++)
vsum+=(a[i]-m)*(a[i]-m);
v=vsum/n;
sd=sqrt)v);
printf(“Mean=%f”,m);
printf(“Variance=%f”,v);
printf(“Standard Division=%f”,sd);
getch();
}

C Programming Archive-mean and variance and standard deviation.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
49 .Write a program to merge the given two sorted arrays into another array. i.e. the elements in the resultant array must also be in a sorted order.
#include<stdio.h>
void main()
{
int a[20], b[20], c[40], i, j, k, as, bs, cs;
clrscr();
printf(“Enter the size of Array A/n”);
scanf(“%d”,&as);
printf(“Enter %d sorted values into array A\n”.as);
for(i=0;i<as;i++);
scanf(“%d”,&a[i]);
printf(“Enter %d sorted values into array B\n”,bs);
for(j=0;j<bs;j++)
scanf(“%d”,&b[j]);
i=j=k=0;
while((i<as) && (j<bs))
{
if (a[i] <= b[j])
{
c[k]=a[i];
i++;
k++;
}
else
{
c[k]=b[j];
j++;
k++;
}
}
/* copy the remaining elements of A to C-array */
while(i<as)
{
c[k] =a[i];
i++;
k++;
}
/* Copy the remaining elements of B array into c array */
while(j<bs)
{
c[k]=b[j];
j++;
k++;
}
cs=as+bs;
printf(“The merged array \n”0;
for(k=0;k<cs;k++)
printf(“%d\n”,c[k]);
getch()
}

C Programming Archive-merge the given two sorted arrays into another array.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
17. Write a program to find the minimum and maximum of given n numbers.
#include<stdio.h>
void main()
{
int n.c.num,max,min;
clrscr();
printf(“Enter how many numbers”);
scanf(“%d”,&n);
printf(“Enter the first number”);
scanf(“%d”,&num);
min=num;
max=num;
c=1;
while(c<n)
{
c++;
printf(“Enter new number:);
scanf(“%d”<&num);
if (num<min)
min=num;
if (num>max)
max=num;

}
printf(“The minimum numbers of the given numbers is %d\n”,min);
printf(“The maximum numbers of the given numbers is %d\n”,max);
getch();
}

C Programming Archive-minimum and maximum of given n numbers.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
39 Write a program to find the minimum number of given numbers using arary.
#include<stdio.h>
void main()
{
int  a[20], i,n,max;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values in the array \n”,n);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
max=a[0];
for(i=1;i<n;i++)
if(a[i] > max)
max=a[i];
printf(“The Maximum value of the given numbers=%d”,max);
getch();
}

C Programming Archive-minimum number of given numbers using arary.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
16. Write a program to find the minimum of given n numbers.
#include<stdio.h>
void main()
{
int n.c.num,min;
clrscr();

printf(“Enter how many numbers”);
scanf(“%d”,&n);
printf(“Enter the first number”);
scanf(“%d”,&num);
min=num;
c=1;
while(c<n)
{
c++;
printf(“Enter new number:);
scanf(“%d”<&num);
if (num<min)
min=num;
}
printf(“The minimum numbers of the given numbers is %d\n”,min);
getch();
}

C Programming Archive-minimum of given n numbers.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

3. Write a program to find the minimum of given two numbers
Method-1:

#include<stdio.h>
main()
{
int a,b;
clrscr();
printf(“Enter two values”);
scanf(“%d%d”,&a,&b);
if (a<b)
printf(“The minimum value is %”,a);
else
printf(“The minimum value is %”,b);
getch();
}
Method-2:
#include<stdio.h>
main()
{
int a,b,min;
clrscr();
printf(“Enter two values”);
scanf(“%d%d”,&a,&b);
if (a<b)
min=a;
else
min=b;
printf(“The minimum value is %”,min);
getch();
}

C Programming Archive-minimum of given two numbers
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
4. Write a program to find the minimum value of given three numbers
Method-1:
#include<stdio.h>
void main()
{
int a,b,c;
clrscr();
printf(“Enter three values”);
scanf(“%d%d%d”,&a,&b,&c);
if((a<b) && (a<c))
printf(“The minimum value is %d”,a);
elseif (b<c)
printf(“The minimum value id %d”,b);
else
printf(“The minimum value id %d”,c);
getch();
}
Method-2:
#include<stdio.h>
void main()
{
int a,b,c,min;
clrscr();
printf(“Enter three values”);
scanf(“%d%d%d”,&a,&b,&c);
if((a<b) && (a<c))
min=a;
elseif (b<c)
min=b;
else
min=c;
printf(“The minimum value id %d”,min);
getch();
}

C Programming Archive-minimum value of given three numbers
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
9.Write a program to generate first five natural number
#include<stdio.h>
void main()
{
int i=1;
clrscr();
while(i<=5)
{
printf(“%d\n”,i);
i++;
}
getch();
}
Another Method:
include<stdio.h>
void main()
{
int i=1;
while(i<=5)
{
printf(“%d\n”,i++);
}
getch();
}

C Programming Archive-natural number
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
26. Write a program to Compute ncr
#include<stdio.h>
void main()
{
int  n,r,i,fn,j,fr,k,fnr,ncr;
clrscr();
printf(“Enter the Value for n and r:”);
scanf(“%d%d”,&n,&r);
fn=fr=fnr=1;
for(i=1;i<=n;i++)
fn  *= i;
for(j=1;j<=r;j++)
fr  *= j;
for(k=1;k<=n-r;k++)
fnr  *= k;
ncr=fn/fr*fnr;
printf(“Ncr Value is=%d\n”,ncr)
getch();
}

C Programming Archive-ncr Computing
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
27. Write a program to Compute npr
#include<stdio.h>
void main()
{
int  n,r,i,fn,k,fnr,npr;
clrscr();
printf(“Enter the Value for n and r:”);
scanf(“%d%d”,&n,&r);
fn=fnr=1;
for(i=1;i<=n;i++)
fn  *= i;
for(k=1;k<=n-r;k++)
fnr  *= k;
npr=fn/fnr;
printf(“Npr Value is=%d\n”,npr)
getch();
}

C Programming Archive-npr Computing
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
21.Write a program to display the odd number less than the accepted value of n
#include<stdio.h>
void main()
{
int  i n;
clrscr();
printf(“Enter the Value for n:”);
scanf(“%d”,&n);
for(i=1;i<=n;i+=2)
{
printf(“%d\n”,i)
}
getch();
}

C Programming Archive-odd number less than the accepted value.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
5.Write a program to check whether the given number is Odd number or Even number
#include<stdio.h>
void main()
{
int no, r
clrscr();
printf(“Enter any number”);
scanf(“%d”,&n);
r=no%2;
if(r==0)
printf(“This is a Even number”):
else
printf(“This is a Odd number”):
getch();
}

C Programming Archive-Odd or Even number
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
65. Write a program to check whether the given string is palindrome or not without using strcmp function.
#include<stdio.h>
#include<conio.h>
void main()
{
char s[100];
int len,i,j,flag=1;
clrscr();
printf(“Enter any string\n”);
scaf(“%s”,s);
len=strlen(s);
for(i=0;j=len-1;i<len/2;i++,j–)
if(s[i] != s[j])
{
flag=0;
berak;
}
if(flag) /* if(flag ==1)] */
printf(“The given string is Palindrome\n”);
else
printf(“The given string is not Palindrome\n”);
getch();
}

C Programming Archive-palindrome or not.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
63.Write a program to check whether the given string is palindrome or not.
#include<stdio.h>
#include<string.h>
void main()
char s1[50],s2[50];
clrscr();
printf(“Enter the original string\n”);
gets(s1);
strcopy(s2,s1);
strrev(s2);
if(stcmp(s1,s2)==0)
printf(“The string is a pallendrome”‘);
else
printf(“The string is not a pallendrome”‘);
getch();
}

C Programming Archive-palindrome String.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
75. Write a program to demonstrate Pointer variables.
#include<stdio.h>
void main()
{
int i=10;
clrscr();
printf(“Address of i = %u\n”,&i);
printf(“Value of i = %d \n”,i);
printf(“Value of i = %d\n”,*(&i));
getch();
}
Output:
1st printf=> 1000
2nd printf=>10
3rd printf=>*(1000)=10;

i
———————–
|    10                  |
———————–
1000
76. Write a program to demonstrate Pointer variables.
#include<stdio.h>
void main()
{
int i=3;
int *j;
j=&i;
clrscr();
printf(“Address of i = %u\n”,&i);
printf(“Address of i = %u \n”,j);
printf(“Address of j = %u\n”,&j);
printf(“Value of i = %d\n”,i);
printf(“Value of i = %d \n”,*(&i));
printf(“Value of i = %d\n”,*j);
getch();
}
Output:
1st printf=> 1000
2nd printf=>1000
3rd printf=>2000.
4th printf=>3
5th printf=>3
6th printf=>3
i
———————–
|    3                  |
———————–
1000

j
———————–
|    1000                 |
———————–
2000
=================================

C Programming Archive-Pointer variables.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
77. Write a program to demonstrate Pointer variables.
#include<stdio.h>
void main()
{
int i=10;
int *j;
/* This is a pointer variable which points to the address of an integer variable */
int **k;
/* This is also a pointer variable which points to the address of address of an integer value(another pointer variable) */
j=&i;
k=&j;
clrscr();
printf(“Address of i = %u\n”,&i);
printf(“Address of i = %u \n”,j);
printf(“Address of i = %u\n”,*k);

printf(“Address of j = %u\n”,&j);
printf(“Address of j = %u \n”,k);
printf(“Address of k = %u\n”,&k);

printf(“Value of i = %d\n”,i);
printf(“Value of i = %d \n”,*(&i));
printf(“Value of i = %d\n”,*j);
printf(“Value of i = %d\n”,**k);
getch();
}
Output:
1st printf=> 1000    6th printf=>3000
2nd printf=>1000    7th printf=>10
3rd printf=>1000    8th printf=>10
4th printf=>2000    9th printf=>10
5th printf=>2000    10th printf=>10
i
———————–
|    10                  |
———————–
1000

j
———————–
|    1000                 |
———————–
2000
k
———————–
|    2000                 |
———————–
3000
====================
C Programming Archive-Pointer variables.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
78. Write a program to demonstrate Pointer variables.
#include<stdio.h>
void main()
{
int i=10;
int *j;
int **k;
int ***p;
j=&i;
k=&j;
p=&k;
clrscr();
printf(“Address of i = %u\n”,&i);
printf(“Address of i = %u \n”,j);
printf(“Address of i = %u\n”,*k);

printf(“Address of j = %u\n”,&j);
printf(“Address of j = %u \n”,k);
printf(“Address of k = %u\n”,&k);

printf(“Address of k = %u\n”,&p);
printf(“Address of j = %u \n”,*p);
printf(“Address of i = %u \n”,**p);

printf(“Value of i = %d\n”,i);
printf(“Value of i = %d \n”,*(&i));
printf(“Value of i = %d\n”,*j);
printf(“Value of i = %d\n”,**k);
printf(“Value of i = %d\n”,***p);
getch();
}
Output:
1st printf=>1000    6th printf=>3000    11th printf=>10
2nd printf=>1000    7th printf=>3000    12th printf=>10
3rd printf=>1000    8th printf=>2000    13th printf=>10
4th printf=>2000    9th printf=>1000    14th printf=>10
5th printf=>2000    10th printf=>10
i
———————–
|    10                  |
———————–
1000

j
———————–
|    1000                 |
———————–
2000
k
———————–
|    2000                 |
———————–
3000
p
———————–
|    3000                 |
———————–
4000
======================
C Programming Archive-Pointer variables.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
29. Write a program to generate the prime number between 1 and n.
#include<stdio.h>
void main()
{
int i,n, mid, flag, num;
clrscr();
printf(“Enter the maximum limit\n”):
scanf(“%d”,&n);
printf(“Prime number generation\n”):
for(num=1;num<=n;num++)
{
flag=1;
mid=num/2;
for(i=2;i<=mid;i++)
if ((num %i)==0)
{
flag=0;
break;
}
if *flag==1) & (num != 2)
printf(“%d\n”,num);
getch();
}

C Programming Archive-prime number between 1 and n.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
24. Write a program to check whether the given number is Prime or not using loops.
#include<stdio.h>
void main()
{
int  i,n,mid, flag=1;
clrscr();
printf(“Enter the Value for n:”);
scanf(“%d”,&n);
for(i=2;i<mid;i++)
{
if((no%i) == 0)
{
flag=0;
break;
}
}
if(flag==1)
printf(“This is a prime number”);
else
printf(“This is not a prime number”);
getch();
}
C Programming Archive-Prime or not .
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

14. Write a program to check whether the given number is prime or not
#include<stdio.h>
void main()
{
int no,r,flag=1,mid, i=2;
clrscr();
printf(“Enter any value”);
scanf(“%d”,&no);
mid=no/2;
while(i<=mid)
{
r=no %i);
if(r==0)
{
flag=0;
break;
}
i++;
}
if(flag==1)
printf(“This is a prime no”);
else
printf(“This is not a prime no”);

getch();
}

C Programming Archive-prime or not.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
23. Write a program to find the product of all devisers of a given number.
#include<stdio.h>
void main()
{
int  i,n,pro=1;
clrscr();
printf(“Enter the Value for n:”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
if((n%i) == 0)
pro *= i;
printf(“Product of division%d\n”,pro)
}

getch();
}

C Programming Archive-product of all devisers of a given number.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
53.Write a program to find the product of given two matrixes of order Am1xn1 and Bm2xn2
#include<stdio.h>
void main()
{
int a[5][5],b[5][5],c[5][5],m1,m2,n1,n2;
clrscr();
printf(“Enter the order of matrix A\n”);
scanf(“%d%d”,&m1,&n1);
printf(“Enter the order of matrix B\n”);
scanf(“%d%d”,&m2,&n2);
if(n1==m2)
{
printf(“Enter %d value into matrix A\n”,m1*n1);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf(“%d”,&a[i][j]);
printf(“Enter %d value into matrix B\n”,m2*n2);
for(i=0;i<m2;i++)
for(j=0;j<n2;j++)
scanf(“%d”,&b[i][j]);
for(i=0;i<m1;i++)
for(j=0;j<n2;j++)
c[i][j]=0;
for(k=0;k<n;k++)
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
printf(“Product of two matrixes \n”);
for(i=0;i<m;i++)
{
for(j=0;j<n2;j++)
printf(“%5d”,c[i][j]);
printf(“\n”);
}
}
else
printf(“Matrix Multiplication is not possible”);
getch();
}

C Programming Archive-product of given two matrixes of order Am1xn1 and Bm2xn2.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
8.Write a program to find the roots of Quardatic equation using switch structure
#include<stdio.h>
#include<math.h>
void main()
{
int a,b,c,opt;
float d,r1,r2;
clrscr();
printf(“Enter the value for a,b,c\n”);
scanf(“%d%d%d%d”,&a,&b,&c,&d);
if(a!=0)
{
d=b*b-4*a*c;
if(d>0)
opt=1;
if(d=0)
opt=2;
if(d<0)
opt=3;
switch(opt)
{
case 1: r1=(-b+sqrt(d))/2*a;
r2=(-b-sqrt(d))/2*a;
printf(“\nValue of r1 = %f”,r1);
printf(“\nValue of r2 = %f”,r2);
printf(“Roots are real and unequal”);
break;
case 1: r1=r2=-b/2*a;
printf(“\nValue of r1 = %f”,r1);
printf(“\nValue of r2 = %f”,r2);
printf(“Roots are equal”);
break;
case 3: printf(“Roots are imaginative”);
break;
}    /*Switch closed*/
} /*Outer if closed*/
else
printf(“\nIt is not a quadratic equation”);
} /*Program end */
getch();
}

C Programming Archive-Quardatic equation using switch structure
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
71. Write a program to generate all random numbers between one hundred and 10,000.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
main()
{
int i,p;
clrscr();
printf(“The random numbers are \n”);
randomize();
/* This initializes the random number generate with a random value */
for(i=100;i<=10000;i++)
{
p=random(i);
/* The random function gives the random value in the range o ‘0’ to i-1; */
if((p>=100) && (p<=10000))
printf(“%7d “,p);
}
getch();                                                                                                                              }

C Programming Archive-random numbers between one hundred and 10,000.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
10.Write a program to find the reverse of a given number.
#include<stdio.h>
void main()
{
long int no, rno=0;
int r;
clrscr();
printf(“Enter any  number”);
scanf(“%ld”,&no);
while(no != 0)
{
r=no%10;
no=no/10;
rno=rno*10+r
}
printf(“Reverse no =%d:,rno);
getch();
}

C Programming Archive-reverse of a given number
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
62.Write a program to find the reverse of a given string.
#include<stdio.h>
#include<string.h>
void main()
{
char s1[50],s2[50];
clrscr();
printf(“Enter the original string\n”);
gets(s1);
strcopy(s2,s1);
strrev(s2);
printf(“The reverse string is %s”,s2);
getch();
}

C Programming Archive-reverse of a given string.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
33. Write a program to find the reverse of given number using while loop and do while loop
#include<stdio.h>
void main()
{
int no, rno=0, r,t;
clrscr();
printf(“Enter any number”):
scanf(“%d”,&n);
t=rno;
while(no!=0)
{
r=no%10;
rno=rno*10+r;
no /=10;
}
printf(“Reverse of number %d”=%d”,t,rno);
getch();
}
Another Method using do while:
#include<stdio.h>
void main()
{
int no, rno=0, r,t;
clrscr();
printf(“Enter any number”):
scanf(“%d”,&n);
t=rno;
do
{
r=no%10;
rno=rno*10+r;
no /=10;
}
while(no!=0)

printf(“Reverse of number %d”=%d”,t,rno);
getch();
}

C Programming Archive-reverse of given number using while loop and do while loop.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

45 Write a program to sort the given element into using Selection sort
#include<stdio.h>
void main()
{
int  a[30], i, j, n, temp;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values into the array \n”,n);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
}
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(a[i] >a[j])
{
temp=a[i];
a[i]= a[j]
a[j]=temp;
}
printf(“The sorted elements are”);
for(i=0;i<n;i++)
printf(“%d\n”,a[i]);
getch();
}

C Programming Archive-Selection sort.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
90.Write a program to sort the given ‘n’ values using function with an indirectional operator(*).
#include<stdio.h>
#include<alloc.h>
void main()
{
int *a,n,i;
clrscr();
void sort(int *b, int m)    /*Proto type */
printf(“Enter How many values do you have? \n”);
scanf(“%d”,&n);
a=(int *)  malloc (a*2);
if(a==null)
{
printf(“Memory allocation Unsuccessful\n”);
exit();
}
printf(“Enter values into the array\n”);
for(i=0;i<n;i++)
scanf(“%d”,(a+i));
sort(a,n);
printf(“The sorted elements are \n”);
for(i=0;i<n;i++)
printf(“%d”,*(a+i));
getch();
}
void sort(int *b, int m)
{
int i, j, temp;
for(i=0;i<=m-1;i++)
for(j=i+1;j<m;j++)
{
temp=*(b+i);
*(b+i)=*(b+j)l
*(b+j)=temp;
}
return;
}
C Programming Archive-sort the given ‘n’ values using function with an indirectional operator(*).
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
74. Write a program to store text into the data file and also display the text from the data file on the data file on the screen.
#include<stdio.h>
main()
{
FILE *fp;
char x;
clrscr();
printf(“Enter the text and finally press ^d\n”);
fp=fopen(“DESH.DAT”,”w”);
while((x=getchar()) !=EOF)
putc(x,fp);
fclose(fp);
printf(“Reading text from the file and display back onto the screen\n”);
fp=fopen(“DESH.DAT”,”r”);
while((x=getc(fp)) != EOF)
printf(“%c\n”,x);
fclose(fp);
getch();
}

C Programming Archive-store text into the data file and also display the text from the data file on the data file on the screen.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
61.Write a program to make the another copy of a given string.
#include<stdio.h>
#include<string.h>

void main()
{
char s1[50],s2[50];
clrscr();
printf(“Enter the original string\n”);
gets(s1);
strcopy(s2,s1);
printf(“The duplicate string is %s’,s2);
getch();
}
C Programming Archive-string copy.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~40 Write a program to find the sum and average of given n numbers.
#include<stdio.h>
void main()
{
int  a[20], i,n,sum=0;
float avg;
clrscr();
printf(“Enter how many values you want to input”):
scanf(“%d”,&n);
printf(“Enter %d values in the array \n”,n);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
sum+=a[i];
}
avg=sum/n;
printf(“The sum of the given numbers=%d”,sum);
printf(“The Average of the given numbers=%f”,avg);
getch();
}

C Programming Archive-sum and average of given n numbers.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
11.Write a program to find the product and sum of all the digits in the given number.
#include<stdio.h>
void main()
{
int no, sum=0, pro=1,r;
clrscr();
printf(“Enter any number”);
scanf(“%d”,&no);
while(no !=0)
{
r=no%10;
sum +=r;
pro *=r;
no=no/10;
}
printf(“Sum of the digit is %d\n”,sum);
printf(“Product of the digit is %d\n”,pro);
getch();
}
C Programming Archive-sum and product of all the digits in the given number.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
51 .Write a program to find the sum of given two matrix of order Amxn and Bixp
#include<stdio.h>
void main()
{
int a[5][5],b[5][5],c[5][5],i,j,m,n,l,p;
clrscr();
printf(“Enter the order of matrix A\n”);
scanf(“%d%d”,&m,&n);
printf(“Enter the order of matrix B\n”);
scanf(“%d%d”,&l,&p);
if((m==l) &&(n==p))
printf(“Enter %d value into matrix x \n”,m*n);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf(“%d”,&a[i][j]);
printf(“Enter %d value into matrix B\N”,l*p);
for(i=0;i<l;i++)
for(j=0;j<p;j++)
scanf(“%d”,&b[i][j]);
for(i=0;i<m;i++)
for(j=0;j<m;j++)
c[i][j]=a[i][j]+b[i][j];
printf(“The sum of the given two matrix \n”);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf(“%5d””,c[i][j]);
printf(“\n”);
}
getch();
}

C Programming Archive-sum of given two matrix of order Amxn and Bixp.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
12.Write a program to find the sum of square of each digit in the number and also find the product of squares of each digit in the given number.
#include<stdio.h>
void main()
{
int no, sum=0, pro=1,r;
clrscr();
printf(“Enter any number”);
scanf(“%d”,&no);
while(no !=0)
{
r=no%10;
sum +=r*r;
pro *=r*r;
no=no/10;
}
printf(“Sum of the digit is %d\n”,sum);
printf(“Product of the digit is %d\n”,pro);
getch();
}

C Programming Archive-sum of square of each digit in the number and also find the product of squares of each digit in the given number.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
22.Write a program to find the sum of the devisers of a given number.
#include<stdio.h>
void main()
{
int n,sum
clrscr();
printf(“Enter the Value for n:”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
if((n%i) == 0)
sum += i;
printf(“Sum of division%d\n”,sum)
}
getch();
}
C Programming Archive-sum of the devisers of a given number.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
80. Write a program to interchange the given two value of ‘a’ and ‘b’ using call by method
#include<stdio.h>
main()
{
int a,b;
clrscr();
void swap(int x, int y);
printf(“Enter two number”):
scanf(“%d%d”,&a,&b);
swap(a,b);
printf(“Value of a =%d\n”,a);
printf(“Value of b =%d\n”,b);
getch();
}
void swap(in x, int y)
{
int t;
t=x;
x=y;
y=t;
printf(“Value of a =%d\n”,x);
printf(“Value of b =%d\n”,y);
}

a=x    b=y    T
A    B    A
B    A    ….
===================
C Programming Archive-Swap two value of ‘a’ and ‘b’ using call by method.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

81. Write a program to interchange the given two values of ‘a’ and ‘b’ using call by reference method
#include<stdio.h>
main()
{
int a,b;
clrscr();
void swap(int *x,int *y)
printf(“Enter two numbers”);
scanf(“%d%d”,&a,&b);
swap(&a,&b);
printf(“Value of a =%d\n”,a);
printf(“Value of b =%d\n”,b);
getch();
}
void swap(int *x, int *y)
{
int t;
t=*x;
*x=*y;
*y=t;
return;
}
a
———————–
|      5                  |
———————–
1000
b
———————–
|    10                 |
———————–
2000
x
———————–
|    1000                 |
———————–
3000
y
———————–
|    2000                 |
———————–
4000
=======================
C Programming Archive-Swap two values of ‘a’ and ‘b’ using call by reference method.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
7.Write a program using switch..case
#include<stdio.h>
void main()
{
int key
clrscr();
scanf(“%d”,&key);
switch(Key)
{
case 0: printf(“Zero\n”);
Break;
case 1 printf(“One\n”);
Break;
case 2 printf(“Two\n”);
Break;
case 3 printf(“Three\n”);
Break;
case 4 printf(“Four\n”);
Break;
case 5 printf(“Five\n”);
Break;
case 6 printf(“Six\n”);
Break;
case 7 printf(“Seven\n”);
Break;
case 8 printf(“Eight\n”);
Break;
case 9 printf(“Nine\n”);
Break;
case 1: printf(“Ten\n”);
Break;
getch();
}
C Programming Archive-switch..case
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
56.Write a program to Check whether the given matrix of order m x m is symmetric or not.
#include<stdio.h>
void main()
{
int a[5][5],b[5][5],i,j,m,flag=1;
clrscr();
printf(“Enter the number of rows and columns of the matrix \n”);
scanf(“%d”,&m);
printf(“Enter %d value into matrix \n”,m*m);
for(i=0;i<m;i++)
for(j=0;j<m;j++)
scanf(“%d”,&a[i][j]);
printf(“The Matrix from”);
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
printf(“%d”,a[i][j]);
printf(“\n”);
}
for(i=0;i<m;i++)
for(j=0;j<m;j++)
b[i][j]=a[j][i];
for(i=0;i<m;i++)
for(j=0;i<n;j++)
if (a[i][j] != b[i][j])
{
flag=0;
break;
}
if(flag==1)
printf(“This is Symmetric\n”);
else
printf(“This is not Symmetric\n”);
getch();
}

C Programming Archive-symmetric matirx or not.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
54.Write a program to display the transpose of given matrix of order m x m
#include<stdio.h>
void main()
{
int a[5][5],b[5][5],i,j,m;
clrscr();
printf(“Enter the number of rows and columns into the matrix \n”);
scanf(“%d”,&m);
printf(“Enter %d value into matrix A\n”,m*m);

for(i=0;i<m;i++)
for(j=0;j<m;j++)
scanf(“%d”,&a[i][j]);
printf(“Matrix A\n”);
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
printf(“%5d”,a[i][j]);
printf(“\n”);
}
for(i=0;i<m;i++)
for(j=0;j<m;j++)
b[i][j]=a[j][i];
printf(“Matrix B\n”);
for(i=0;i<m;i++)
for(j=0;j<m;j++)
printf(“%5d”,b[i][j]);
printf(“\n”);
}
getch();
}
C Programming Archive-Transpose of given matrix of order m x m.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~
55.Write a program to display the transpose of given matrix of order m x n
#include<stdio.h>
void main()
{
int a[5][5],b[5][5],i,j,m,n;
clrscr();
printf(“Enter the number of rows and columns into the matrix \n”);
scanf(“%d%d”,&m,&n);
printf(“Enter %d value into matrix A\n”,m*n);

for(i=0;i<m;i++)
for(j=0;i<n;j++)
scanf(“%d”,&a[i][j]);
printf(“Matrix from of given element\n”);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf(“%5d”,a[i][j]);
printf(“\n”);
}
for(i=0;i<m;i++)
for(j=0;j<m;j++)
b[i][j]=a[j][i];
printf(“Matrix from of transpose element\n”);
for(i=0;i<n;i++)
for(j=0;i<m;j++)
printf(“%5d”,b[i][j]);
printf(“\n”);
}
getch();
}
C Programming Archive-transpose of given matrix of order m x n.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

85.Display the output of following program
#include<stdio.h>
void main()
{
int a[4]={1,2,10,20};
int i, *p;
p=&a[0];
clrscr();
printf(“The value from the array\n’);
for(i=0;i<4;i++)
printf(“Value %d in the address %u\n”,*p,p++);
getch();
}
a[0]    a[1]    a[2]    a[3]
1    2    10    20

1000            1002            1004            1006
p
———————–
|    1000                 |
———————–
2000
Output:
serial no    Value of a[i]    Address = &a[i]
1    1    1000
2    2    1002
3    10    1004
4    20    1006
========================================
C Programming Archive-What Oputput.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
79. What is the output of the following program?
#include<stdio.h>
void main()
{
int a, *b, **c, ***d, ****c;
clrscr();
a=10;
b=&a;
c=&b;
d=&c;
e=&d;
printf(“a=%d b=%u c=%u d=%u e=%u”,a,b,c,d,e);
printf(“%d%d%d”,a,a+*b,**c+**d+****e);
getch();
}
a
———————–
|    10                  |
———————–
1000

b
———————–
|    1000                 |
———————–
2000
c
———————–
|    2000                 |
———————–
3000
d
———————–
|    3000                 |
———————–
4000
2
e
———————–
|    4000                 |
———————–
5000

Output:
a=10
b=1000
c=2000
d=3000
e=4000
a=10
a+*b=10+*(1000)=10+10=20
OR
**C+***d+****e
=**(2000)+***(3000)+****(4000)
=*(1000) + **(2000) +***(3000)
=10+*(1000)+**(2000)
=10+10+*(1000)
=10+10+10=30
============================
C Programming Archive-What output
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
84.Diaplay the output of following program
#include<stdio.h>
void main()
{
int a[4]={1,2,10,20};
int i;
clrscr();
printf(“The value from the array\n’);
for(i=0;i<4;i++)
printf(“Value %d in the address %u\n”,a[i],&a[i]);
getch();
}
a[0]    a[1]    a[2]    a[3]
1    2    10    20

1000            1002            1004            1006
Output:
serial no    Value of a[i]    Address = &a[i]
1    1    1000
2    2    1002
3    10    1004
4    20    1006
=========================================
C Programming Archive-What Output
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
86.Diaplay the output of following program
#include<stdio.h>
void main()
{
int a[4]={1,2,10,20};
int i;
clrscr();
printf(“The value from the array\n’);
for(i=0;i<4;i++)
printf(“Value %d in the address %u\n”,*(a+i),(a+i));
getch();
}
a[0]    a[1]    a[2]    a[3]
1    2    10    20

1000            1002            1004            1006
Output:
serial no    Value of a[i]    Address = &a[i]
1    1    1000
2    2    1002
3    10    1004
4    20    1006
============================================

C Programming Archive-What Output
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
87.Diaplay the output of following program
#include<stdio.h>
void main()
{
int a[4]={1,2,10,20};
int i, *p;
clrscr();
p=a;
printf(“The value from the array\n’);
for(i=0;i<4;i++)
printf(“The Value %d in the address %u\n”,*(p+i),(p+i));
getch();
}
a[0]    a[1]    a[2]    a[3]
1    2    10    20

1000            1002            1004            1006
Output:
Value of *(p+i)    Address of (p+i)
1    1000
2    1002
10    1004
20    1006
=================================================

C Programming Archive-What Output
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~~^~^~
83.Diaplay the output of following program
main()
{
int a=5,**aa;
aa=&a;
a=power(&aa);
printf(“a=%d\n aa=%u\n”,a,aa);
}
int power(int **ptr)
{
int b;
b=**ptr * **ptr;
return(b)
}
a
———————–
|      5                  |
———————–
1000
aa
———————–
|    10                 |
———————–
2000
ptr
———————–
|    2000              |
———————–
3000
Output: a=5*5=25, aa=1000
=====================

C Programming Archive-What output.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~^~^~^~^~^~~^~^~^~^~^~^~

Facebook page-From the Heart of Bangladesh

Advertisements
  1. you are really a good webmaster. The site loading speed is amazing. It seems that you are doing any unique trick. In addition, The contents are masterpiece. you have done a magnificent job on this topic!

    Like

  2. I am really impressed with your writing talents as smartly as with the format for your weblog. Is that this a paid subject matter or did you customize it yourself? Either way keep up the excellent high quality writing, it’s uncommon to peer a nice weblog like this one nowadays..

    Like

  3. Thanks , I have recently been looking for info approximately this subject for a long time and yours is the best I’ve found out so far. But, what in regards to the conclusion? Are you positive about the source?

    Like

  4. I am extremely impressed with your writing abilities as neatly as with the structure to your blog. Is this a paid subject matter or did you modify it yourself? Anyway stay up the excellent quality writing, it is rare to look a great blog like this one nowadays..

    Like

  5. I truly treasure your work , Great post.

    Like

  6. Someone necessarily lend a hand to make significantly posts I would state. That is the first time I frequented your web page and up to now? I amazed with the analysis you made to make this actual put up amazing. Wonderful process!

    Like

  7. By my notice, shopping for technology online may be easily expensive, but there are some tips and tricks that you can use to help you get the best bargains. There are often ways to locate discount deals that could help to make one to ge thet best electronics products at the cheapest prices. Interesting blog post.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: