C Program on array manipulations

array manipulations in C , C Assignment array manipulations


#include
main()
{
int a[20],b[20],n,i,j,temp,sb,ss,sbp,ssp;
clrscr();
printf("ENTER HOW MANY ELEMENTS\n");
scanf("%d",&n);
printf("ENTER %d ELEMENTS\n",n);
for (i=0;i<n;i++)
scanf("%d",&a[i]);
for (i=0;i<
b[i]=a[i];
for (i=0;i

{

for (j=i+1;j

if (a[i]

{

temp=a[i];

a[i]=a[j];

a[j]=temp;

}

}

sb=a[1];

ss=a[n-2];

for (i=0;i

{

for (j=i+1;j

{

if (b[i]==sb)

sbp=i;

if (b[i]==ss)

ssp=i;

}

}

b[sbp]=ss;

b[ssp]=sb;

printf("AFTER INTERCHANGING THE SECOND BIGGEST ELEMENT AND\n");

printf("THE SECOND SMALLEST ELEMENT THE ARRAY IS\n");

for (i=0;i

printf("%d\n",b[i]);

getch();

}











Related Links :

C Program to find frequency table, frequency table in C Language, C assignment to find frequency table

C Program to find frequency table, frequency table in C Language, C assignment to find frequency table


#include

main()

{

int a[20],c=0,d=0,i,j=0,n;

clrscr();

printf("ENTER ANY NUMBER\n");

scanf("%d",&n);

printf("ENTER %d NUMBERS\n",n);

for (i=0;i<n;i++)

scanf("%d",&a[i]);

do

{

j++;

for (i=0;i

if (a[i]==j)

{

c++;

d++;

}

if (c!=0)

{

printf("%d OCCURED %d TIMES\n",j,c);

c=0;

}

}

while(n!=d);

getch();

}





Related Links :

C Program to print the triangle

C Program to print the triangle, creating a triangle in C



#include

main()

{

int n,i,j,k=5;

clrscr();

printf("ENTER THE NUMVER OF LINES ");

scanf("%d",&n);

for(i=n;i>0;i--)

{

for(j=0;j

printf(" ");

for(j=1;j<=i;j++)

printf("%2d",i);

k++;

printf("\n");

}

getch();

}



Related Links :

Program adding two polynomials in C, add two polynomials using array

adding two polynomials in C, C Program to add two polynomials using array, adding two polynomials in C, Addition of 2 polynomials in C


#include
#include
#define MAX 10
struct term
{
int coeff;
int exp;
};
struct poly
{
struct term t[10];
int totalterms;
};
void initpoly(struct poly*);
void polycreate(struct poly*,int c,int e);
struct poly addpoly(struct poly,struct poly);
void display(struct poly);
void main()
{
struct poly p1,p2,p3;
clrscr();
initpoly(&p1);
initpoly(&p2);
initpoly(&p3);
polycreate(&p1,1,7);
polycreate(&p1,2,6);
polycreate(&p1,3,5);
polycreate(&p1,4,4);
polycreate(&p1,5,2);
polycreate(&p2,1,4);
polycreate(&p2,1,3);
polycreate(&p2,1,2);
polycreate(&p2,1,1);
polycreate(&p2,2,0);
p3=addpoly(p1,p2);
printf("\n First polynomial :\n ");
display(p1);
printf("\n Second polynomial :\n ");
display(p2);
printf("\n\n Resultant Polynomial :\n");
display(p3);
getch();
}
/* Initializes elements of struct poly */
void initpoly(struct poly *p)
{
int i;
p->totalterms=0;
for(i=0;i {
p->t[i].coeff=0;
p->t[i].exp=0;
}
}

/* Add the term of polynomial to the array t */
void polycreate(struct poly *p,int c,int e)
{
p->t[p->totalterms].coeff=c;
p->t[p->totalterms].exp=e;
(p->totalterms)++;
}

/* DISPLAY the polynomial equation */
void display(struct poly p)
{
int flag=0,i;
for(i=0;i {
if(p.t[i].exp != 0)
printf("%d x^%d + ",p.t[i].coeff,p.t[i].exp);
else
{
printf("%d",p.t[i].coeff);
flag=1;
}
}
if(!flag)
printf("\b\b");
}
/* ADD two polynomials p1 and p2 */
struct poly addpoly(struct poly p1,struct poly p2)
{
int i,j,c;
struct poly p3;
initpoly(&p3);
if(p1.totalterms>p2.totalterms)
c=p1.totalterms;
else
c=p2.totalterms;
for(i=0,j=0;i<=c;p3.totalterms++)
{
if(p1.t[i].coeff==0 && p2.t[j].coeff==0)
break;
if(p1.t[i].exp>=p2.t[j].exp)
{
if(p1.t[i].exp==p2.t[j].exp)
{
p3.t[p3.totalterms].coeff=p1.t[i].coeff + p2.t[j].coeff;
p3.t[p3.totalterms].exp=p1.t[i].exp;
i++;
j++;
}
else
{
p3.t[p3.totalterms].coeff=p1.t[i].coeff;
p3.t[p3.totalterms].exp=p1.t[i].exp;
i++;
}
}
else
{
p3.t[p3.totalterms].coeff=p2.t[j].coeff;
p3.t[p3.totalterms].exp=p2.t[j].exp;
j++;
}
}
return p3;
}



Related Links :

Program to show the use of static variables in C Language

Program to show the use of static variables in C Language



#include
#incl.ude
void stat();
void main()
{
int c;
clrscr();
for(c=1;c<=3;c++)
stat();
getch();
}

void stat()
{
static int sv=0;
sv=sv+1;
printf("%d\n",sv);
}


Related Links :

Mouse Programming in C,mouseposi, mousehide, mouseposi, setposi Function in C

Mouse Programming in C,mouseposi, mousehide, mouseposi, setposi Function in C




#include
#include
#include
#include
union REGS in,out;

int callmouse()
{
in.x.ax=1;
int86(51,&in,&out);
return 1;
}
void restrictmouseptr(int x1,int y1,int x2,int y2)
{
in.x.ax=7;
in.x.cx=x1;
in.x.dx=x2;
int86(51,&in,&out);
in.x.ax=8;
in.x.cx=y1;
in.x.dx=y2;
int86(51,&in,&out);
}
int main()
{
int x,y,cl,a,b;
clrscr();
int g=DETECT,m;
initgraph(&g,&m,"c:\tc\bgi");
rectangle(100,100,550,400);
callmouse();
restrictmouseptr(100,100,550,400);
getch();
}

Related Links :

callmouse() Function in C

callmouse() Function in C

callmouse() :- In this function AX is set to "1". When this function is called in main() it displays the mouse pointer. The position of the pointer can be changed by using the mouse.

Related Links :

C Program to Find prime numbers in an array using function

C Program to Find prime numbers in an array using function, find Prime Numbers from array, given array find prime numbers, Prime Number calculation from array


#include
int prime(int n)
{
int i,flag=1;
for(i=2;i<=n/2;i++)
{
if(n%i==0)
{
flag=0;
break;
}
}
return flag;
}

main()
{
int arr[50],l,i,count=0;
printf(“Enter number of elementsn”);
scanf(“%d”,&l);
printf(“Enter %d numbersn”,l);
for(i=0;i<l;i++)
{
scanf(“%d”,&arr[i]);
}
for(i=0;i<l;i++)
{
if(prime(arr[i])==1)
count++;
}
if(count==0)
{
printf(“There are no prime numbers in the listn”);
}
else
{
printf(“There are %d prime number(s) in the listn”,count);
for(i=0;i<l;i++)
{
if(prime(arr[i])==1)
printf(“%dn”,arr[i]);
}
}
}

Related Links :

C PROGRAM TO READ A FLOATING POINT NUMBER AND DISPLAYS THE RIGHT MOST DIGIT OF THE INTEGRAL PART OF THE NUMBER

C PROGRAM TO READ A FLOATING POINT NUMBER AND DISPLAYS THE RIGHT MOST DIGIT OF THE INTEGRAL PART OF THE NUMBER


#include
main()
{
float num;
int ip,rm;
printf(“Enter a floating point number”);
scanf(“%f”,&num);
ip=(int)num;
rm=ip%10;
printf(“Right most digit of integral part=%dn”,rm);
}



Related Links :

C program using do…while loop to print the first m Fibonacci numbers, Fibonacci numbers Series

C program using do…while loop to print the first m Fibonacci numbers, Fibonacci numbers Series

#include
main()
{
int a=1,b=1,c=0,m,i=0;
printf(“Enter limitn”);
scanf(“%d”,&m);
do
{
printf(“%dt”,a);
i++;
c=a+b;
a=b;
b=c;
}
while(i

Related Links :

C program to convert a decimal number to binary number, decimal number to binary number Conversion in C, C assignment to convert Decimal to binary

C program to convert a decimal number to binary number, decimal number to binary number Conversion in C, C assignment to convert Decimal to binary


#include
main()
{
int tenpow=1,num,i,bin=0;
printf(“Enter a decimal number”);
scanf(“%d”,&num);
do
{
bin+=(num%2)*tenpow;
tenpow*=10;
num/=2;
}
while(num>0);
printf(“Binary equivalent=%dn”,bin);

}

Related Links :

c assignment to find the sum of primary diagonal of a matrix

c assignment to find the sum of primary diagonal of a matrix




#include
void main()
{
int A[5][5],i,j,m,n,sum = 0;
clrscr();
printf("\n\n\t ENTER A ORDER OF THE MATRIX M,N...: ");
scanf("%d,%d",&m,&n);
printf("\n\n\t ENTER THE ELEMENTS OF THE MATRIX..:\n\n");
if(m == n)
{
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
gotoxy(20+j*4,12+i*2);
scanf("%d",&A[i][j]);
}
printf("\n");
}
for(i=1;i<=m;i++)
sum = sum + A[i][i];
printf("\n\t THE SUM OF PRIMARY DIAGONAL OF A MATRIX IS...: %d", sum);
}
else
{
printf("\n\t THE ORDER OF THE MATRIX IS NOT CORRECT");
printf("\n\n\t HELP : 'M' SHOULD BE EQUAL TO 'N'");
}
getch();
}

Related Links :

C Program to find the sum of the cos series

C Program to find the sum of the cos series , COS series in C, C Language Cos Series calculation.



#include
#include
void main()
{
float pow = 2.0, nr, dr = 1.0, x1, sum;
int i = 1,n,s = -1,x;
clrscr();
printf("\n\n\t ENTER THE ANGLE...: ");
scanf("%d", &x);
x1 = 3.142 * (x / 180.0);
sum = 1.0;
nr = x1*x1;
printf("\n\t ENTER THE NUMBER OF TERMS...: ");
scanf("%d",&n);
while(i<=n)
{
dr = dr * pow * (pow - 1.0);
sum = sum + (nr / (dr * s));
s = s * (-1);
pow = pow + 2.0;
nr = nr * x1 * x1;
i++;
}
printf("\n\t THE SUM OF THE COS SERIES IS..: %0.3f", sum);
getch();
}


Related Links :

C Program to find the sum of the sine series


C Program to find the sum of the sine series , Sine Series In C, Sum of Sine Series In C Language, C Assignment to find Sin Series in C .

#include
#include
#include
void main()
{
int i = 2, n, s = 1, x, pwr = 1, dr;
float nr = 1, x1, sum;
clrscr();
printf("\n\n\t ENTER THE ANGLE...: ");
scanf("%d", &x);
x1 = 3.142 * (x / 180.0);
sum = x1;
printf("\n\t ENTER THE NUMBER OF TERMS...: ");
scanf("%d", &n);
while(i <= n)
{
pwr = pwr + 2;
dr = dr * pwr * (pwr - 1);
sum = sum + (nr / dr) * s;
s = s * (-1);
nr = nr * x1 * x1;
i+= 2;
}
printf("\n\t THE SUM OF THE SINE SERIES IS..: %0.3f",sum);
getch();
}



Related Links :

C Assignment to Find Given Year leap year or Not

C Assignment to Find Given Year leap year or Not


#include
#include
void main()
{
int yr;
clrscr();
printf("Please enter the year");
scanf("%d",&yr);
if((yr%400==0)&&(yr/4==0))
printf("leap year");
else
printf("not leap year");
getch();
}



Related Links :

Program to Check whether First number is divisible by second number or not



#include
#include
void main()
{
int n1,n2;
clrscr();
printf("enter the values of Number1 and Number 2");
scanf("%d %d",&n1,&n2);
if(n1%n2==0)
printf("First no is divisible by second");
else
printf("Sorry !!! not divisible");
getch();
}




Program to Check whether First number is divisible by second number or not

Related Links :

C Program to print ASCII value of given character

C Program to print ASCII value of given character



#include
#include
void main()
{
char ch;
clrscr();
printf("please enter any character");
scanf("%c",&ch);
printf("The ASCII Value =%d",ch);
getch();
}


Related Links :

C Program to Perform Arithmetic operations

C Program to Perform Arithmetic operations



#include
#include
void main()
{
int a,b,add,sub,mul,div;
clrscr();
printf("Enter any 2 numbers");
scanf("%d %d", &a,&b);
add=a+b;
printf("The addition of numbers=%d",add);
sub=a-b;
printf("The substraction of number=%d",sub);
mul=a*b;
printf("The multiplication of number=%d",mul);
div=a/b;
printf("The division of numbers=%d",div);
getch();
}


Related Links :

C Program to find absolute value

C Program to find absolute value



#include
#include
void main()
{
int a,b;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
if(a<0)
{
b=a*-1;
printf("\nabsolute value of %d is %d",a,b);
}
else
{
printf("\nabsolute value=%d",a);
}
getch();
}


Related Links :

C Program to calculate Discount in Bill



#include
#include
main()
{
float ttamt,qnt,rate,dis;
clrscr();
printf ("enter the value of rate and qty");
scanf ("%f%f",&rate,&qnt);
ttamt=qnt*rate;
if(ttamt>2000)
{
ttamt=ttamt-(ttamt*10)/100;
printf(" \n ttamt=%f",ttamt);
}
else
{


printf(" \n ttamt=%f",ttamt);
}
getch();
}


Related Links :

Convert string to integer without using library functions in c

Convert string to integer without using library functions in c




#include
int stringToInt(char[] );
int main(){

char str[10];
int intValue;

printf("Enter any integer as a string: ");
scanf("%s",str);

intValue = stringToInt(str);

printf("Equivalent integer value: %d",intValue);

return 0;
}

int stringToInt(char str[]){
int i=0,sum=0;

while(str[i]!='\0'){
if(str[i]< 48 || str[i] > 57){
printf("Unable to convert it into integer.\n");
return 0;
}
else{
sum = sum*10 + (str[i] - 48);
i++;
}

}

return sum;

}


Related Links :

C Program to print STAR PATTERNS and pyramids


C Program to print STAR PATTERNS and PYRAMIDS



main()
{
char prnt = '*';
int i, j, k, s, c = 1, numb = 9;
for (i = 1; c <= 4; i++)
{
if ((i % 2) != 0)
{
for (j = 1; j <= i; j++)
{
printf("%2c", prnt);
}for (s = numb; s >= 1; s--)
{
if (c == 4 && s == 1)
{
break;
}
printf(" ");
}
for (k = 1; k <= i; k++)
{
if (c == 4 && k == 5)
{
break;
}
printf("%2c", prnt);
}
printf("\n");
numb = numb - 4;
++c;
}
}
}



Related Links :

C Program to evaluate the power series

C Program to evaluate the power series , power of series in C, C Assignment to calculate power of series


#include
#include
#define EXA 0.0001
void main()
{
int n,count;
float x,term,sum;
printf("Please Enter value of x : ");
scanf("%f",&x);
n=term=sum=count=1;
while(n<=100)
{
term=term*(x/n);
sum=sum+term;
count=count+1;
if(term<EXA)
n=999;
else
n=n+1;
}
printf(" TERMS = %d SUM = %f\n",count,sum);
getch();
}





Related Links :

C Program to print asterisk, star patterns

C Program to print asterisk, star patterns image star
C Program to print asterisk, star patterns

main()
{
char prnt = '*';
int i, j, numb = 4, k;
for (i = 1; i <= 5; i++) { for (k = numb; k >= 1; k--)
{

printf(" "); // Spacing factor
}
for (j = 1; j <= i; j++) { printf("%2c", prnt); } printf("\n"); --numb; } getch(); }

Related Links :

factorial of a number in C++



#include
#include
void main()
{
int i,f,n;
f=1;
cout <<"enter the number \n";
cin > > n;
for(i=1;i<=n;i++)
f=f*i;
cout <<"Factorial of number is "<<f;
getch();
}


Related Links :

C Program to find twin prime numbers, twin Prime Numbers by using C language

C Program to find twin prime numbers, twin Prime Numbers by using C language



void main()
{
int n,i,k,r,ary[50],p;
clrscr();
printf(" Enter Maximum Value For Numbers: ");
scanf("%d",&r);
i=1;
p=0;
while(i<=r)
{
k=0;n=1;
while(n<=i)
{
if(i%n==0)
k++;
n++;
}
if(k==2)
{
ary[p]=i;
p++;
}
i++;
}

for(n=0;n<p;n++)
{
if(ary[n+1]-ary[n]==2)
printf("\n %d and %d are TWIN PRIME Numbers ",ary[n],ary[n+1]);
}
getch();
}



Related Links :

c program which restricts the movement of pointer



void main()
{
union REGS k,o;
//show mouse pointer
k.x.ax=1;
int86(0x33,&k,&o);
//x coordinate restriction
k.x.ax=7;
k.x.cx=20;
k.x.dx=300;
int86(0x33,&k,&o);
//y coordinate restriction
k.x.ax=8;
k.x.cx=50;
k.x.dx=250;
int86(0x33,&k,&o);
getch();
}

Related Links :

Most c compilers Most widely used

Most c compilers Most widely used

There are various c compilers are variables. Some of these are:



S.N.
Name
Microprocessor
OS
1
Turbo c 3.0
8086
MS DOS
2
ANSIC C
80386
LINUX
3
Borland C 4.0
80386
WINDOW
4
Microsoft C
8086
MS DOS
5
Visual C++
80386
WINDOW






Related Links :

while loop without any Loop body



main()
{
int i=0;

while(i++,i<=8);
printf("%d ",i);
return 0;
}



Related Links :

c program to create dos command DIR, Program to create a DIR Dos Command

c program to create dos command DIR, Program to create a DIR Dos Command


#include “stdio.h”
#include “dos.h”
void main(int count,char *argv[]){
struct find_t q ;
int a;
if(count==1)
argv[1]="*.*";
a = _dos_findfirst(argv[1],1,&q);
if(a==0){
while (!a){
printf(" %s\n", q.name);
a = _dos_findnext(&q);
}
}
else{
printf("File not found");
}
}



Related Links :

c program which display mouse pointer and position of pointer.(In x coordinate, y coordinate)

c program which display mouse pointer and position of pointer.(In x coordinate, y coordinate)


#include”dos.h”
#include”stdio.h”
void main()
{
union REGS i,o;
int x,y,k;
//show mouse pointer
i.x.ax=1;
int86(0x33,&i,&o);
while(!kbhit()) //its value will false when we hit key in the key board
{
i.x.ax=3; //get mouse position
x=o.x.cx;
y=o.x.dx;
clrscr();
printf("(%d , %d)",x,y);
delay(250);
int86(0x33,&i,&o);
}
getch();
}



Related Links :

C code to print or display lower triangular matrix

C code to print or display lower triangular matrix



#include
int main(){
int a[3][3],i,j;
float determinant=0;

printf("Enter the 9 elements For the matrix: ");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("\nThe matrix is\n");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++)
printf("%d\t",a[i][j]);
}
printf("\n Setting zero in upper triangular matrix\n");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++)
if(i<=j)
printf("%d\t",a[i][j]);
else
printf("%d\t",0);
}


return 0;
}



Related Links :

Strassen algorithm C Program to Multiply matrix

C Program of two 2 by 2 matrix multiplication using Strassen algorithm (It is faster than the standard matrix multiplication algorithm ), Strassen algorithm C Program to Multiply matrix


#include
int main(){
int a[2][2],b[2][2],c[2][2],i,j;
int m1,m2,m3,m4,m5,m6,m7;
printf("Enter the 4 elements For first matrix: ");
for(i=0;i<2;i++)
for(j=0;j<2;j++)
scanf("%d",&a[i][j]);
printf("Enter the 4 elements For second matrix: ");
for(i=0;i<2;i++)
for(j=0;j<2;j++)
scanf("%d",&b[i][j]);
printf("\nThe first matrix is\n");
for(i=0;i<2;i++){
printf("\n");
for(j=0;j<2;j++)
printf("%d\t",a[i][j]);
}
printf("\nThe second matrix is\n");
for(i=0;i<2;i++){
printf("\n");
for(j=0;j<2;j++)
printf("%d\t",b[i][j]);
}

m1= (a[0][0] + a[1][1])*(b[0][0]+b[1][1]);
m2= (a[1][0]+a[1][1])*b[0][0];
m3= a[0][0]*(b[0][1]-b[1][1]);
m4= a[1][1]*(b[1][0]-b[0][0]);
m5= (a[0][0]+a[0][1])*b[1][1];
m6= (a[1][0]-a[0][0])*(b[0][0]+b[0][1]);
m7= (a[0][1]-a[1][1])*(b[1][0]+b[1][1]);

c[0][0]=m1+m4-m5+m7;
c[0][1]=m3+m5;
c[1][0]=m2+m4;
c[1][1]=m1-m2+m3+m6;

printf("\nAfter multiplication using Strassen's matrix\n");
for(i=0;i<2;i++){
printf("\n");
for(j=0;j<2;j++)
printf("%d\t",c[i][j]);
}

return 0;
}



Related Links :

Sum of diagonal elements of a matrix in c

Sum of diagonal elements of a matrix in c



#include

int main(){

int a[10][10],i,j,sum=0,m,n;

printf("\nEnter the row and column of matrix: ");
scanf("%d %d",&m,&n);

printf("\nEnter the elements of matrix: ");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("\nThe matrix is\n");

for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<m;j++){
printf("%d\t",a[i][j]);
}
}
for(i=0;i<m;i++){
for(j=0;j<n;j++){
if(i==j)
sum=sum+a[i][j];
}
}
printf("\n\nSum of the diagonal elements of a matrix is: %d",sum);

return 0;
}




Related Links :

C Program to print or display lower triangular matrix

C Program to print or display lower triangular matrix


#include
int main(){
int a[3][3],i,j;
float determinant=0;

printf("Enter the 9 elements of the matrix: ");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);

printf("\nThe matrix is\n");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++)
printf("%d\t",a[i][j]);
}

printf("\nSetting zero in upper triangular matrix\n");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++)
if(i<=j)
printf("%d\t",a[i][j]);
else
printf("%d\t",0);
}


return 0;
}



Related Links :

C program to find inverse of a matrix , inverse of a matrix in C

C program to find inverse of a matrix , inverse of a matrix in C


#include

int main(){

int a[3][3],i,j;
float determinant=0;

printf("Enter the 9 elements of matrix: ");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);

printf("\nThe matrix is\n");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++)
printf("%d\t",a[i][j]);
}

for(i=0;i<3;i++)
determinant = determinant + (a[0][i]*(a[1][(i+1)%3]*a[2][(i+2)%3] - a[1][(i+2)%3]*a[2][(i+1)%3]));

printf("\nInverse of matrix is: \n\n");
for(i=0;i<3;i++){
for(j=0;j<3;j++)
printf("%.2f\t",((a[(i+1)%3][(j+1)%3] * a[(i+2)%3][(j+2)%3]) - (a[(i+1)%3][(j+2)%3]*a[(i+2)%3][(j+1)%3]))/ determinant);
printf("\n");
}

return 0;
}



Related Links :

Write a c program to find out transport of a matrix


#include
int main(){
int a[10][10],b[10][10],i,j,k=0,m,n;
printf("\n Enter the row and column of matrix");
scanf("%d %d",&m,&n);
printf("\nEnter the First matrix->");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("\nThe matrix is\n");
for(i=0;i<m;i++){
printf("\n");
for(j=0;j<m;j++){
printf("%d\t",a[i][j]);
}
}
for(i=0;i for(j=0;j<n;j++)
b[i][j]=0;
for(i=0;i<m;i++){
for(j=0;j<n;j++){
b[i][j]=a[j][i];
printf("\n%d",b[i][j]);
}
}
printf("\n\nTraspose of a matrix is -> ");
for(i=0;i<m;i++){
printf("\n");
for(j=0;j<m;j++){
printf("%d\t",b[i][j]);
}
}
return 0;
}









KeyWords : transport of a matrix in C, transport of a matrix Programming in C Language, C Assignment to transport of a matrix,Matrix Program in C

Related Links :

c program to find out NCR factor of given number

c program to find out NCR factor of given number


#include
int main(){
int n,r,ncr;
printf("Enter any two numbers->");
scanf("%d %d",&n,&r);
ncr=fact(n)/(fact(r)*fact(n-r));
printf("The NCR factor of %d and %d is %d",n,r,ncr);
return 0;
}
int fact(int n){
int i=1;
while(n!=0){
i=i*n;
n--;
}
return i;
}



Related Links :

C program to print Pascal triangle using for loop

C program to print Pascal triangle using for loop


#include
int main(){
int line,i,j,k;
printf("Enter the no. of lines");
scanf("%d",&line);
for(i=1;i<=line;i++){
for(j=1;j<=line-i;j++)
printf(" ");
for(k=1;k printf("%d",k);
for(k=i;k>=1;k--)
printf("%d",k);
printf("\n");
}
return 0;
}



Related Links :

c program to print Floyd’s triangle

c program to print Floyd’s triangle


#include


int main(){
int i,j,r,k=1;

printf("Enter the range: ");
scanf("%d",&r);

printf("FLOYD'S TRIANGLE\n\n");
for(i=1;i<=r;i++){
for(j=1;j<=i;j++,k++)
printf(" %d",k);
printf("\n");
}

return 0;
}








OUTPUT :


1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55

Related Links :

C Program To FIND POWER OF A NUMBER USING C PROGRAM

C Program To FIND POWER OF A NUMBER USING C PROGRAM



#include
int main(){
int pow,num,i=1;
long int sum=1;
printf("\n Enter a number: ");
scanf("%d",&num);
printf("\n Enter Value for power: ");
scanf("%d",&pow);
while(i<=pow){
sum=sum*num;
i++;
}
printf("\n%d to the power %d is : %ld",num,pow,sum);
return 0;
}



Related Links :

C program to print Armstrong numbers from 1 to 500

C program to print Armstrong numbers from 1 to 500



#include
int main(){
int num,r,sum,temp;

for(num=1;num<=500;num++){
temp=num;
sum = 0;

while(temp!=0){
r=temp%10;
temp=temp/10;
sum=sum+(r*r*r);
}
if(sum==num)
printf("%d ",num);
}

return 0;
}


Related Links :

Check the given number is Armstrong number or not using c program

Check the given number is Armstrong number or not using c program



#include
int main()
{
int num,r,sum=0,temp;
printf("Enter a number: ");
scanf("%d",&num);
temp=num;
while(num!=0){
r=num%10;
num=num/10;
sum=sum+(r*r*r);
}
if(sum==temp)
printf("%d is an Armstrong number",temp);
else
printf("%d is not an Armstrong number",temp);

return 0;
}


Related Links :

C Program to Check Whether Number is Perfect Or Not

C Program to Check Whether Number is Perfect Or Not



#include
int main()
{
int n,i=1,sum=0;
printf("\n Please Enter a number: ");
scanf("%d",&n);
while(i<n){
if(n%i==0)
sum=sum+i;
i++;
}
if(sum==n)
printf("\n%d is a Perfect Number",i);
else
printf("\n%d is Non Perfect Number",i);
return 0;
}

Related Links :

C Program to insert and delete a node from the binary search tree

C Program to insert and delete a node from the binary search tree



#include
#include
#include
#define TRUE 1
#define FALSE 0
struct btreenode
{
struct btreenode *leftchild;
int data;
struct btreenode *rightchild;
};
void insert(struct btreenode **,int);
void del(struct btreenode **,int);
void search(struct btreenode **,int,struct btreenode **,struct btreenode **,int *);
void inorder(struct btreenode *);
void main()
{
struct btreenode *bt;
int req;
int i=0,num,a[]={10,7,11,5,8,12,16,15,6};
bt=NULL; /* Empty Tree */
clrscr();
while(i<=8) { insert(&bt,a[i]); i++; } clrscr(); printf(" Binary tree before deletion :\n"); inorder(bt); del(&bt,11); printf("\n Binary tree after deletion :\n"); inorder(bt); del(&bt,10); printf("\n Binary tree after deletion :\n"); inorder(bt); del(&bt,6); printf("\n Binary tree after deletion :\n"); inorder(bt); del(&bt,16); printf("\n Binary tree after deletion :\n"); inorder(bt); getch(); } /* inserts a new node in a binary search tree */ void insert(struct btreenode **sr,int num) { if(*sr==NULL) { (*sr)=malloc(sizeof(struct btreenode)); (*sr)->leftchild=NULL;
(*sr)->data=num;
(*sr)->rightchild=NULL;
}
else /* Search the node to whilch new node will be attatched */
{
/* If new data is less, traverse to left*/
if(num<(*sr)->data)
insert(&((*sr)->leftchild),num);
else
/* Else traverse to right */
insert(&((*sr)->rightchild),num);
}
}
/* Deletes a node from the binary search tree */
void del(struct btreenode **root,int num)
{
int found;
struct btreenode *parent,*x,*xsucc;
/* If tree is empty */
if(*root == NULL)
{
printf("\n Tree is Empty ");
return;
}
parent=x=NULL;
/* Call to search function to find the node to be deleted */
search(root,num,&parent,&x,&found);
/* If the node to be deleted is not found */
if(found == FALSE)
{
printf("\n Data to be deleted , not found ");
return;
}
/* If the node to be deleted has two children */
if(x->leftchild !=NULL && x->rightchild!=NULL)
{
parent=x;
xsucc=x->rightchild;
while(xsucc->leftchild != NULL)
{
parent=xsucc;
xsucc=xsucc->leftchild;
}
x->data=xsucc->data;
x=xsucc;
}
/* If the node to be deleted has no child */
if(x->leftchild==NULL && x->rightchild==NULL)
{
if(parent->rightchild==x)
parent->rightchild=NULL;
else
parent->rightchild=NULL;
free(x);
return;
}
/* If the node to be deleted has only right child */
if(x->leftchild==NULL && x->rightchild !=NULL)
{
if(parent->leftchild==x)
parent->leftchild=x->rightchild;
else
parent->rightchild=x->rightchild;
free(x);
return;
}
/* If the node to be deleted has only left child */
if(x->leftchild != NULL && x->rightchild==NULL)
{
if(parent->leftchild==x)
parent->leftchild=x->leftchild;
else
parent->rightchild=x->rightchild;
free(x);
return;
}
}

/* Returns the address of the node to be deleted ,address of its parent and whether the node is found or not */
void search(struct btreenode **root,int num,struct btreenode **par,struct btreenode **x,int *found)
{
struct btreenode *q;
q=*root;
*found=FALSE;
*par=NULL;
while(q!=NULL)
{
/* If the node to be deleted is found */
if(q->data == num)
{
*found=TRUE;
*x=q;
return;
}
if(q->data==num)
{
*found=TRUE;
*x=q;
return;
}
*par=q;
if(q->data > num)
q=q->leftchild;
else
q=q->rightchild;
}
}
/* Traverse a binary search tree in an LDR(Left-Data-Right) fashion */
void inorder(struct btreenode *sr)
{
if(sr!=NULL)
{
inorder(sr->leftchild);
/* Print the data of the node whose leftchild is NULL or the path has already been traversed */
printf("%d\t",sr->data);
inorder(sr->rightchild);
}
}



Related Links :

C PROGRAMS CONVERT TEMPERATURE FROM DEGREE CELSIUS TO DEGREE FAHRENHEIT

C PROGRAMS CONVERT TEMPERATURE FROM DEGREE CELSIUS TO DEGREE FAHRENHEIT


#include
#include
main()
{
int c;
float f;
clrscr();
printf("Enter temp in degree Celsius");
scanf("%d",&c);
f=(float)9/5*c+ 32;
printf("\n temp in deg. Celsius=%d C and in deg. fah =%fF",c,f);
getch();
}



Related Links :

C PROGRAMS TO FIND EFFICIENCY AND OUTLET TEMP OF COMPRESSOR


#include
#include
#include
main()
{
float ti,to,pi,po,e,g=1.4;
clrscr();
printf("enter ti,pi,and po Values...");
scanf("%f%f%f",&ti,&pi,&po);
to=ti *pow(po/pi,(g-1)/ g);
e=l-pow(pi/po,(g-1 )/g);
printf("outlet temp=%f efficiency=%f" ,to,e);
getch();
}



Related Links :

C program to convert Days into Year months, weeks and leftover days

C program to convert Days into Year months, weeks and leftover days



#include
#include
main()
{
int days,month,week,year;
clrscr();
year=0;
printf("enter days");
scanf("%d" ,&days);
month=days/30;
days%=30;
week=days/7;
days%=7;
year=month/12;
printf("equivalent months=%d weeks=%d and·
leftoverdays=%d" ,month,week,days);
if (year>0)
{
printf("\n The Years are %d",year);
}
getch();
}



Related Links :

C PROGRAM TO CREATE Triangle USING FOR LOOP TO OBTAIN THE Triangle

C PROGRAM TO CREATE Triangle USING FOR LOOP TO OBTAIN THE Triangle


#include



main()
{
int i,j;
for(i=7;i>0;i–)
{

for(j=i;j>0;j–)



{

printf(“*\t”);

}

printf(“\n\v”);

}

}





Related Links :

C Program to RECURSIVE FUNCTION FIND FACTORIAL OF A NUMBER

C Program RECURSIVE FUNCTION TO FIND FACTORIAL OF A NUMBER


#include

int fact(int n)
{
int factor=1;
if(n==1)
{
return 1;
}
else
{
factor=n*fact(n-1);
return factor;
}
}
main()
{
int n;
printf(“Enter a number\n”);
scanf(“%d”,&n);
printf(“Factorial of %d = %d\n”,n,fact(n));
}



Related Links :

C Program to create Tower Of Hanoi


#include
#include
class hanoi
{
int disk;
char beg[4],end[4],aux[4];
public:
void move(int,char[],char[],char[]);
};

void hanoi::move(int disk,char frmtwr[4],char totwr[4],char auxtwr[4])
{
if (disk==1)
{
cout<<”\nMove disk 1 from tower “<<frmtwr<<” to tower “<<totwr;
return;
}
move(disk-1,frmtwr,auxtwr,totwr);
cout<<”\nMove disk “<<disk<<” from tower “<<frmtwr<<” to tower “<<totwr;
move(disk-1,auxtwr,totwr,frmtwr);
return;
}

void main()
{
int n;
hanoi object;
clrscr();
cout<<”Tower Of Hanoi\n”;
cout<<”Let the towers be BEG,AUX & END\n”;
cout<<”Enter the number of disks: “;
cin>>n;
object.move(n,”BEG”,”END”,”AUX”);
getch();
}



Related Links :

Important Question On C Language Asked in Interview or Viva

Important Question On C Language Asked in Interview or Viva


Well following are the commonly asked interview question which you may have to face in your interview or Campus interview Selection rounds ....


1.Define friend function.
A: A friend function is a non-member function of a class which has access to the private members of that class.

2.How is they declared and defined?
A: A friend function is declared in a class using the keyword friend. It is defined outside the class like any other normal functions.

3.How is a friend function invoked?

A: A friend function is invoked like a normal function in C++.

4.What are reference variables and what is their use?

A: A reference variable acts as alias to the another variable.

5.What are the features of OOP?

A: 1:Class,2.Object,3.Data abstraction and encapsulation,4.Polymorphism,5.Dynamic binding,6.Message passing.

6.What is dynamic binding?

A: The linkage between a procedure call and the code to be executed is known at run time is called dynamic binding. It’s related to polymorphism.

7.Define polymorphism.


8.What are two types of polymorphisms? Give example for both.

A: Compile time polymorphism and run-time polymorphism,eg: function overloading and virtual functions respectively.

9.What is a do nothing function?

A: A function declared in a base class and does not do any operations and is redefined in sub classes is called a do nothing function.

10.Define pointers.

A: Pointers are used to store address of memory locations.


Best of Luck Friends.... :)

Related Links :

C Program to SORT A LIST OF n POSITIVE INTEGERS IN ASCENDING ORDER

C Program to SORT A LIST OF n POSITIVE INTEGERS IN ASCENDING ORDER


#include

main()
{
int arr[20],i,j,temp;
printf(“Enter Ant 20 Numbers\n”);
for(i=0;i<20;i++)
{
scanf(“%d”,&arr[i]);
}
for(i=0;i<19;i++)
{
for(j=i;j<20;j++)
{
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
printf(“Sorted array…\n”);
for(i=0;i<20;i++)
{
printf(“%d\n”,arr[i]);
}
}






Keywords : Sort positive numbers, C Program to sort positive numbers, sort sending +ve numbers in C, c assignments to sort numbers, C Program to sort ascending numbers

Related Links :

C Program to show SEQUENTIAL SEARCH

C Program to show SEQUENTIAL SEARCH



#include

main()
{
int arr[50],k,i,l,pos=0;
printf(“Enter limit For SEQUENTIAL SEARCH\n”);
scanf(“%d”,&l);
printf(“Enter %d elements\n”,l);
for(i=0;i<l;i++)
{
scanf(“%d”,&arr[i]);
}
printf(“Enter a number to be search\n”);
scanf(“%d”,&k);
for(i=0;i<l;i++)
{
if(arr[i]==k)
{
pos=i+1;
break;
}
}
if(pos!=0)
printf(“%d is found in the list, at position %d\n”,k,pos);
else
printf(“%d is not in the list\n”,k);

}





OUTPUT:



Enter limit For SEQUENTIAL SEARCH

10

Enter 10 elements

11

23

58

31

56

77

43

12

65

19

Enter a number to be search

31

31 is found in the list, at position 4

Related Links :

C Program FOR MATRIX MULTIPLICATION

C Program FOR MATRIX MULTIPLICATION



#include
main()
{
int a[20][20],b[20][20],c[20][20],r1,c1,c2,r2,i,j,k;
printf(“\tEnter the row and coloumn size For matrix1\n”);
scanf(“%d%d”,&r1,&c1);
printf(“\tEnter the row and coloumn size For matrix2\n”);
scanf(“%d%d”,&r2,&c2);
if (c1!=r2)
{
printf(“\tOppssss...The Coloumn size of Matrix1 not equal to row size of Matrix2\n\tMultiplication impossible/n”);
}
else
{
printf(“\tEnter elemnts of matrix1\n”);
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
scanf(“%d”,&a[i][j]);
}
}
printf(“\tEnter elements of matrix2\n”);
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
{
scanf(“%d”,&b[i][j]);
}
}
for(i=0;i<r1;i++)
{
for(j=0;j<c2;j++)
{
c[i][j]=0;
for(k=0;k<c1;k++)
{
c[i][j]+=a[i][k]*b[k][j];
}
}
}
printf(“\tYes...!! Product Matrix…\n”);
for(i=0;i<r1;i++)
{
for(j=0;j<c2;j++)
{
printf(“\t%d\t”,c[i][j]);
}
printf(“\n”);
}
}
}






OUTPUT:



Enter the row and coloumn size of matrix1
3
3
Enter the row and coloumn size of matrix2
3
3
Enter elemnts of matrix1
1
2
3
4
5
6
7
8
9

Enter elemnts of matrix2
9
8
7
6
5
4
3
2
1

Product Matrix…

30 24 18

84 69 54

138 114 90

Related Links :

C Program TO REPLACE A PARTICULAR WORD BY ANOTHER WORD IN GIVEN STRING

C Program TO REPLACE A PARTICULAR WORD BY ANOTHER WORD IN GIVEN STRING


#include
#include
main()
{
int lr,m,x,t,l,ll,ls,i,j,k,flag,count=0;
char line[200],str[20],rep[20];
printf(“Enter line of text\n”);
gets(line);
printf(“Enter the word to replace\n”);
scanf(“%s”,str);
printf(“Enter the word to replace with\n”);
scanf(“%s”,rep);
ll=strlen(line);
ls=strlen(str);
lr=strlen(rep);
for(i=0;i<ll;i++)
{
if(line[i]==str[0]&&((line[i-1]==’ ‘||i==0)&&(line[i+ls]==’ ‘||line[i+ls]==’\0′)))
{
for(flag=0,k=i,j=0;j{
if(line[k]==str[j])
{
flag++;
}
}
if(flag==ls)
{
if(lr>ls)
{
for(m=lr-ls;m>0;m–)
{
ll=strlen(line);
for(l=ll;l>i;l–)
{
line[l+1]=line[l];
}
}
}
else if(lr{
for(m=ls-lr;m>0;m–)
{
ll=strlen(line);
for(l=i;l<ll;l++)
{
line[l]=line[l+1];
}
}
}
else
{
}
for(x=0,t=i;x<lr;x++,t++)
{
line[t]=rep[x];
}
}
}
}
printf(“Text\n”);
puts(line);
}





Output :


Enter line of text

Snehal IS A GOOD GIRL

Enter the word to replace

GIRL

Enter the word to replace with

BOY

Text

Snehal IS A GOOD BOY

Related Links :

C Program using RECURSIVE FUNCTION TO FIND FACTORIAL OF A NUMBER


#include

int fact(int n)
{
int factor=1;
if(n==1)
{
return 1;
}
else
{
factor=n*fact(n-1);
return factor;
}
}

main()
{
int n;
printf(“Enter a number\n”);
scanf(“%d”,&n);
printf(“Factorial of %d = %d\n”,n,fact(n));
}




OUTPUT:



Enter a number

7

Factorial of 7 = 5040

Related Links :

C Program to Convert Lowercase Letters to Upper Case, Small to capital Letters in C

C Program to Convert Lowercase Letters to Upper Case, Small to capital Letters in C


#include

#include

void convert(char strng[])
{
int i,l;
l=strlen(strng);
for(i=0;i{
if(strng[i]>=97&&strng[i]<=122)
{
strng[i]=strng[i]-32;
}
}
printf(“Please Entered Any string\n%s\n”,strng);
}
main()
{
char strng[20];
printf(“Enter a string\n”);
gets(strng);
convert(strng);
}



Related Links :

C Program to print Fibonacci numbers Series

C Program to print Fibonacci numbers Series


#include

main()

{

int a=1,b=1,c=0,m,i=0;

printf(“Enter limit\n”);

scanf(“%d”,&m);

do
{

printf(“%d\t”,a);

i++;

c=a+b;

a=b;

b=c;

}while(i<m);

printf(“\n”);

}





OUTPUT:




Enter limit

8

1 1 2 3 5 8 13 21

Related Links :

C++ Program to find given String is Palindrome or Not

C++ Program to find given String is Palindrome or Not


#include
#include
#include
void main()
{
char a[10],b[10];
clrscr();
cout<<"Please Enter Any String";
cin>>a;
strcpy(b,a);
strrev(b);
if(strcmp(a,b)==0)
{
cout<<"Enter String is Palindrome";
}
else
{
cout<<"Enter String is not Palindrome";
}
getch();
}


Related Links :

C++ Program to find Sum of Given Digits

C++ Program to find Sum of Given Digits



#include
#include
void main()
{
int d1,ori,add;
add=0;
cout<<"enter the number";
cin>>ori;
while(ori!=0)
{
d1=ori%10;
ori=ori/10;
add=add+d1;
}
cout<<"sum of digit"<<add;
getch();
}



Related Links :

C++ Program to Find roots are imaginary

C++ Program to Find roots are imaginary


#include
#include
#include
void main()
{
int a,b,c;
clrscr();
cout<<"enter the values of a,b,c";
cin>>a>>b>>c;
int d=(b*b)-4ac ;
if (d<0)
cout<<"\n\t roots are imaginary";
if(d==0)
{
float x;
x=-b/2*a;
cout<<"\n\t X="< < x;
}
if(d>0)
{
float x1,x2;
x1=-b+sqrt(d)/2*a;
x2=-b-sqrt(d)/2*a;
cout<<"\n\t x1="< < x1;
cout<<"\n\t x2="< < x2;
}
getch();
}





Related Links :

C++ Program to find given number is Prime or Not

C++ Program to find given number is Prime or Not


#include e
#include
void main()
{
int num=0,k=0,i;
clrscr();
cout<<"Enter the value of num";
cin>>num;
for(i=2;i<=num-1;i++)
{
k=num%i;
if(k==0)
{
break;
}
else
{
continue;
}
}
if(k==1)
{
cout<<"Given num is prime" ;
}
else
{
cout<<"Given num is not prime";
}
getch();
}






Related Links :

C++ Program to Reverse the given array values

C++ Program to Reverse the given array values


#include
int main()
{
int a[10],i;
cout<<"enter the array:";
for(i=0;i<10;i++)
{
cin>>a[i];
}
cout<<"reverce array is:";
for(i=9;i>=0;i--)
{
cout<<a[i]<<"\n";
}
return0
}



Related Links :

Overloading Program in C++

Overloading Program in C++



#include
#include
double sum(double,int);
long sum(long,int,int);
void main()
{
clrscr();
cout<<"\n\t +" <<sum(70,34);
cout<<"\n\t +" <<sum(100,76,98);
getch();
}
double sum(double a,int b)
{
return(a+b);
}
long sum(long c,int d,int e)
{
int f;
f=c+d+e;
return(f);
}



Related Links :

C Program to show method of Insertion Sort

C Program to show method of Insertion Sort



#include
#include
#include

/* The Insertion Sort. */
void insert(char *items, int count)
{

register int a, b;
char t;

for(a=1; a < count; ++a) {
t = items[a];
for(b=a-1; (b >= 0) && (t < items[b]); b--)
items[b+1] = items[b];
items[b+1] = t;
}
}


int main(void)
{

char s[255];

printf("Enter a string:");
gets(s);
insert(s, strlen(s));
printf("The sorted string is: %s.\n", s);

return 0;
}


Related Links :

C Program to swap two numbers

C Program to swap two numbers




#include
#include
void main()
{
int a,b,t;
clrscr();
printf("enter the value of a and b");
scanf("%d%d",&a,&b);
t=a;
a=b;
b=t;
printf("a=%d,b=%d",a,b);
getch();
}


Related Links :

C Program to Print Acsii Value of Given Number

C Program to Print Acsii Value of Given Number

#include
#include
void main()
{
char ch;
clrscr();
printf("enter any character");
scanf("%c",&ch);
printf("ch=%d",ch);
getch();
}



Related Links :

C Program to find absolute value of given number

C Program to find absolute value of given number




#include
#include
void main()
{
int a,b;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
if(a<0)
{
b=a*-1;
printf("\nabsolute value of %d is %d",a,b);
}
else
{
printf("\nabsolute value=%d",a);
}
getch();
}


Related Links :

switch case vowels and consonants by using OR operator

Switch case vowels and consonants by using OR operator


#include
#include
main()
{
char x;
clrscr();
printf("Enter the charecter");
scanf("%c",&x);
if(x=='a'||'e'||'i'||'o'||'u')
printf("is vowel");
else
printf("is consonant");
getch();
}



Related Links :

Switch Case Program to identify Vowels and Consonants in C

Switch Case Program to identify given character Vowels and Consonants in C



/* wap to determine whether the entered chracter is consonant or vowel*/
#include
main()
{
char ch;
clrscr();
printf("\n Enter any character:");
scanf("%c",&ch);
switch(tolower(ch))
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
printf("\n The character is vowel!");
break;
default :
printf("\n The chracter is consonant!");
}
getch();
}



Related Links :

C Program to accept arithmetic operator, accept two numbers and perform given operation

C Program to accept arithmetic operator, accept two numbers and perform given operation



#include
main()
{
char ch;
int num1,num2;
clrscr();

printf("\nEnter number ,another number and operator:");
fflush(stdin);
scanf("%d%d",&num1,&num2);
ch=getchar();
switch(ch)
{
case '+':
printf("\n addition of 2 numbers=%d",num1+num2);
break;
case '-':
printf("\n subtraction of 2 numbers=%d",num1-num2);
break;
case '/':
printf("\n division of 2 numbers=%d",num1/num2);
break;
case '*':
printf("\n multiplication of 2 numbers=%d",num1*num2);
break;
default:
printf("\n wrong choice!");
}
getch();
}




Related Links :

Two dimensional Array Transpose of Matrix In C, 2-D Array Dimensional, Multidimensional Array in C

Two dimensional Array Transpose of Matrix In C, 2-D Array Dimensional, Multidimensional Array in C



#include
#include
main()
{
int r[4][4],c[4][4],i,j,m,n;
clrscr();
printf("Enter the range of row=");
scanf("%d",&m);
printf("enter the range of columns=");
scanf("%d",&n);
for(i=0;i {
for(j=0;j {
scanf("%d",&r[i][j]);
}
}
printf("Matrix is=\n");
for(i=0;i {
for(j=0;j {
printf("%d\t",r[i][j]);
}
printf("\n");
}
printf("Transpose=\n");
for(i=0;i {
for(j=0;j {
printf("%d\t",r[j][i]);
}
printf("\n");
}
getch();
}







Related Links :

C Program (WAP) to show addition of two 2-dimensional Array

C Program (WAP) to show addition of two 2-dimensional Array

#include

#include
main()
{
int a[2][2],b[2][2],c[2][2],i,j;
clrscr();
printf("Enter the elements of matrix a=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Matrix is=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
printf("Enter the elements of matrix b=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
printf("Matrix is=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",b[i][j]);
}
printf("\n");
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
printf("Sum is=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n");
}
getch();
}

Related Links :

C Program to do Subtraction matrix by using 2D (2 Dimensional) Array

C Program to do Subtraction matrix by using 2D (2 Dimensional) Array



#include
#include
main()
{
int a[2][2],b[2][2],c[2][2],i,j;
clrscr();
printf("Enter the elements of matrix a=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("matrix is=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
printf("Enter the elements of matrix b=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
printf("Matrix is=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",b[i][j]);
}
printf("\n");
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=a[i][j]-b[i][j];
}
}
printf("Substraction=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n");
}
getch();
}







Related Links :

Find circumference of circle in C

Find circumference of circle in C



#include
#include

main()

{
float r,circumference;
clrscr();

printf ("enter value for r");

scanf("%f",&r);
circumference=2*3.14*r;

printf(" %f",circumference);

getch();
}





Related Links :

C Program to identify user entered number,Capital Letter, Small Letter or Symbol

C Program to identify user entered number,Capital Letter, Small Letter or Symbol




#include
#include
main()
{
char c;
clrscr();
printf (" enter any character");
scanf ("%c",&c);
if(c>=65 && c<=90)
printf (" capital letter");
else
{
if(c>=97 && c<=122)
printf (" small letter");
else
{
if(c>=48 && c<=57)
printf (" digit");
else
printf (" symbol");
}
}
getch();
}


Related Links :

Follow Anna


Dear Friends,

Thanks For Joining the My blog lernc.blogspot.com, well.... this Newsletter is mainly for My all Indian Friends Because the Revolution started By Anna Hajare is very Great opportunity for all of Indians to remove the corruption from INDIA, on this Occasion of Independence day we must decide thats we must follow Anna Hajare & give him full co-operation for his revolution.... No every Indian must be treat as ANNA & Must Join this revolution to make Indian free From Corruption ...

http://en.wikipedia.org/wiki/Anna_Hazare


भ्रष्‍टाचार के खिलाफ अन्‍ना हजारे की इस मुहीम से जुड़ने के लिए 022- 61550789 नंबर पर मिस्‍ड कॉल कर सकते हैं.

हजारे ने कहा, ‘मैं तब तक आमरण अनशन पर रहूंगा जब तक सरकार जन लोकपाल विधेयक का मसौदा बनाने वाली संयुक्त समिति में 50 प्रतिशत अधिकारियों के साथ बाकी स्थानों पर नागरिकों और विद्वानों को शामिल करने पर सहमत नहीं हो जाती.’ हजारे ने प्रधानमंत्री की अपील के बावजूद अपना अनशन शुरू किया. प्रधानमंत्री कार्यालय ने कल रात उनके फैसले पर निराशा जताई थी.
हम सब भारत वासियों को अन्ना हजारेजी को समर्थन देना है और ज्यादा से ज्यादा संख्या में नई दिल्ली पहुचना है.... या जहा है वहासे भी एकजुट होके अन्नाके के समर्थन में शांतिपूर्ण आन्दोलन करना चाहिए ... ताकि हम सब लोग इस भ्रष्टाचार से मुक्त हो सके और एक नए भारत का निर्माण कर सके. ... ध्यान रखिये ७४ सालके अन्ना हजारे आपके बच्चो के लिए ये सब कर रहे है ताकि उन्हें किसीको रिश्वत देनेकी नौबत न आये धन्यवाद् ... आपका दोस्त पंकज ...

Forward This mail To maximum Friends...

Thanks

From : lernc.blogspot.com (Glearn.Net Team)
Info Groups ( IGCT, India )

Related Links :

C Program to TO REVERSE THE GIVEN STRING using Pointers

C Program to TO REVERSE THE GIVEN STRING using Pointers


#include
#include
void strev(char *str1, char *str2);
void main()
{
char *str1, *str2;
clrscr();
printf("\n\n\t PLZ ENTER A STRING...: ");
gets(str1);
strev(str1,str2);
printf("\n\t YOUR THE REVERSED STRING IS...: ");
puts(str2);
getch();
}
void strev(char *str1, char *str2)
{
int i = 0, len = 0, r = 0;
while(*(str1+len)!='\0')
len++;
for(i=len-1; i>=0; i--)
{
*(str2+r) = *(str1+i);
r++;
}
*(str2+r) = '\0';
}





Related Links :

C Program to Printing on a printer Directly


#include
int main(void)
{
fprintf(stdprn, "It will Print on Printer Directly....");
fprintf(stdprn, "\n\rNo Out Put On Screen... ???\n\r");
fprintf(stdprn, "\n\rCheck it your self... :) \f");
return 0;
}








Related Links :

C Program to Identify, detect given string is palindrome or not

C Program to Identify, detect given string is palindrome or not



#include
#include
#define size 26

void main()
{
char strsrc[size];
char strtmp[size];

clrscr();
printf("\n Enter String:= "); gets(strsrc);

strcpy(strtmp,strsrc);
strrev(strtmp);

if(strcmp(strsrc,strtmp)==0)
printf("\n Entered string \"%s\" ispalindrome",strsrc);
else
printf("\n Entered string \"%s\" is not
palindrome",strsrc);
getch();
}



Related Links :

In C Or C++ How to find the memory leakage in the Program or project project

In C Or C++ How to find the memory leakage in the Program or project project

Well Friends i am providing a link of software which will help to find memory leakage in your project, Try it...

Related Links :

Sorting Text file Using C Program

Sorting Text file Using C Program



#include
#include
#include
const int MAX = 1024;
void insert_sorted (long *sorted, int count, long value)
{
int i = 0;
sorted[count] = value;
if (count == 0) return;
for (i = count;i >= 0; i--)
{
if (value < sorted[i-1])
sorted[i] = sorted[i-1];
else break;
}
sorted[i] = value;
}
int main (int argc, char *argv[])
{
FILE *infile = NULL;
long sorted[1024];
long value;
int count = 0;
int i = 0;
if (argc < 2) {
fprintf (stderr, "Usage : %s \n", argv[0]);
return 1;
}
infile = fopen (argv[1], "r");
if (NULL == infile) {
perror ("fopen");
return -1;
}
/* while file not ends */
while (!feof (infile)) {
fscanf (infile, "%ld\n", &value); /* fetch value */
insert_sorted (sorted, count, value); /* sort */
++count; /* increase number of sorted values */
}
/* display values */
printf ("Sorted values : ");
for (i = 0; i < count; i++ ) {
printf ("%ld ", sorted[i]);
}
/* cleanup */
if (infile) {
fclose (infile);
infile = NULL;
}
return 0;
}

Related Links :

memcpy Function Example in C



#include
#include
int main(void)
{
char array[1];
char *p;
p = (char *) malloc(sizeof(char)*20);
memcpy(p,"Life is Good",10);
memcpy(array,p,10);
printf("\n %s \n",array);
return 0;
}


Related Links :

C program to calculate length of given string & reverse string

C program to calculate length of given string & reverse string



#include
#include
#include
void main(){
int len;
char s[15];
clrscr();
printf("Enter a String : - ");
scanf("%s",s);
len=strlen(s);
printf("\n Length of String - %d ",len);
printf("\n Original String :- %s",s);
strrev(s);
printf("\n Reverse String :- %s",s);
getch();
}



Related Links :

C Program to calculate sum of array elements in C

C Program to calculate sum of array elements in C




#include
#include
void main(){
int array[5]={4,8,9,13,25};
int i,sum=0;
for(i=0;i<5;i++){
sum=sum+array[i];
}
printf("Sum of Array is %d ",sum);
getch();
}


Related Links :

C Program to reverse the given string

C Program to reverse the given string




#include
#include
main()
{
char str[50],revstr[50];
int i=0,j=0;
printf("Enter the string to be reversed : ");
scanf("%s",str);
for(i=strlen(str)-1;i>=0;i--)
{
revstr[j]=str[i];
j++;
}
revstr[j]='\0';
printf("Input String : %s",str);
printf("\nOutput String : %s",revstr);
getch();
}


Related Links :

C Program to sort the marks of students given in pre defined Array

C Program to sort the marks of students given in pre defined Array


#include
void sort(int m, int x[]);
main()
{
int i;
int marks[5]={40, 90, 73, 81, 35};
clrscr();
printf("Marks before sorting\n");
for(i=0; i<5; i++)
printf("%4d", marks[i]);
printf("\n\n");
sort(5,marks);
printf("Marks after sorting\n");
for(i=0; i<5; i++)
printf("%4d", marks[i]);
printf("\n");
getch();
}
void sort(int m, int x[])
{
int i, j, temp;
for(i=1; i<=m-1; i++)
{
for(j=1;j<=m-1;j++)
{
if(x[j-1]>=x[j]
{
temp=x[j-1];
x[j-1]=x[j];
x[j]=temp;
}
}
}
}





Related Links :

currency rate conversion Program by using pre-processor in C Language

currency rate conversion Program by using pre-processor in C Language



//file1.h
#define USD 1

//file2.h
#define UKP 1

//file3
#include
#include

#if (defined (USD))
#define currency_rate 46
#elif (defined (UKP))
#define currency_rate 100
#else
# define currency_rate 1
#endif

main()
{
int rs;
rs = 10 * currency_rate;
printf (“%d\n”, rs);
}




Related Links :

Pre Processing Calculation Example in C Language

Pre Processing Calculation Example in C Language


#define CUBE(x) x*x*x //A
#include
main ()
{
int k = 5;
int j = 0;
j = CUBE(k);
printf (“value of j is %d\n”, j);
}





Related Links :

Pre Processor Example in C

Pre Processor Example in C

#include
#define VAL 40; //A
#undef VAL //B
#define VAL 40 //C

main()
{
printf (“%d\n”, VAL); //D
}




Related Links :

Basic Pre-Processing Example In C

Pre-Processing Example In C



# include

#define VAL 35 // A
#define HELLO “HELLO”; // B

main ()
{
int res;

res = VAL-5; // C
printf (“res = VAL-5: res == %d\n”, res);

printf ( HELLO); //D
}



Related Links :

One Dimensional, two dimensional and 3-Dimensional Array Creation in C Language

One Dimensional, two dimensional and 3-Dimensional Array Creation in C Language



#include
main()
{
int a[2][3][4];
int b[3][4];
int c[4];
int cnt=0;
for(int i=0;i<2;i++)
for(int j=0;j<3;j++)
for(int k=0;k<4;k++)
{
a[i][j][k] = cnt;
cnt;
}
}
void print_onedim(int a[])
{
for(int i=0;i<4;i++)
printf("%d ",a[i]);
}
void print_twodim(int a[][4])
{
for(int j=0;j<3;j++)
print_onedim(a[j]);
printf("\n");
}
void print_threedim(int a[][3][4])
{
printf("Each two dimension matrix\n");
for(int j=0;j<2;j++)
print_twodim(a[j]);;

}

Related Links :

C Program to Prove Memory allocation for Integer is 2 byte by using array & Pointer

C Program to Prove Memory allocation for Integer is 2 byte by using array & Pointer


#include
void printarr(int a[]);
void printdetail(int a[]);
void print_usingptr_a(int a[]);
main()
{
int a[5];
int *b;
int *c;
for(int i = 0;i<5;i++)
{
a[i]=i;
}
printarr(a);
*b=2;
b++;
*b=4;
b++;
*b=6;
b++;
*b=8;
b++;
*b=10;
b++;
*b=12;
b++;
a=c; //error
printarr(a);


}
void printarr(int a[])
{
for(int i = 0;i<5;i++)
{
printf("value in array %d\n",a[i]);
}
}
void printdetail(int a[])
{
for(int i = 0;i<5;i++)
{
printf("value in array %d and address is %16lu\n",a[i],&a[i]);
}
}

void print_usingptr_a(int a[])
{

for(int i = 0;i<5;i++)
{
printf("value in array %d and address is %16lu\n",*a,a);
a++; // increase by 2 bytes
}
}


Related Links :

C Program to Print Value and address of an array elements

C Program to Print Value and address of an array elements

#include 
void printarr(int a[]);
main()
{
int a[5];
for(int i = 0;i<5;i++)
{
a[i]=i;
}
printarr(a);
}
void printarr(int a[])
{
for(int i = 0;i<5;i++)
{
printf("value in array %d\n",a[i]);
}
}
void printdetail(int a[])
{
for(int i = 0;i<5;i++)
{
printf("value in array %d and address is %16lu\n",a[i],&a[i]);
}
}

Related Links :

C Program to show Working of an array


#include
main()
{
int a[5];
for(int i = 0;i<5;i++)
{
a[i]=i;
}
printarr(a);
}
void printarr(int a[])
{
for(int i=0;i<5;i++)
{
printf("value in array %d\n",a[i]);
}
}




Related Links :

C Program to show recursive function in c with stack overheads massage and memory address showing

C Program to show recursive function in c with stack overheads massage & memory address showing


#include
int fact(int n);
long old=0; \\E
long current=0; \\F
main()
{
int k = 4,i;
long diff;
i =fact(k);
printf("The value of i is %d\n",i);
diff = old-current;
printf("stack overheads are %16lu\n",diff);
}
int fact(int n)
{
int j;
static int m=0;
if(m==0) old =(long) &j;
if(m==1) current =(long) &j;
m++; \\C
printf("the address of j and m is %16lu %16lu\n",&j,&m);
if(n<=0)
return(1);
else
return(n*fact(n-1));
}





Related Links :

C Program to interchange the values of two different strings variable

C Program to interchange the values of two different strings variable


main ( )
{
char * s1 = “abcd”;
char s2[] = “efgh”;
printf( “%s %16lu \n, s1, s1);
printf( “%s %16lu \n, s2, s2);

s1 = s2;
printf( “%s %16lu \n, s1, s1);
printf( “%s %16lu \n, s2, s2);
}




Related Links :

C Program to Count the Number od Characters in given string by using /0

C Program to Count the Number of Characters in given string by using /0

main ( )
{
char s1[6] = “abcde ”;
int cnt = 0;
cnt = cnt_str(s1); \\ A
printf( “ total characters are %d \n”, cnt);
}
int cnt_str(char s1[]); \\ B
{
int cn = 0;
while ( (cn < 6) && s1[cn]! = ‘\0’)
cn++;
return(cn);
}

Related Links :

C Mark list Program using Structure

C Mark list Program using Structure

struct student  
{
char name[30];
float marks;
} ;

main ( )
{
struct student *student1;
struct student student2;
char s1[30];
float f;
student1 = &student2;
scanf (“%s”, name);
scanf (“ %f”, & f);
*student1.name = s1;
student1-> name = f;
*student2.marks = f;
student1-> marks = s1;

printf (“ Name is %s \n”, *student1.name);
printf (“ Marks are %f \n”, *student2.marks);
}




Related Links :

C Multiple Structure Program of Mark-list

C Multiple Structure Program of Mark-list



struct student
{
name char[30];
marks float;
}
main ( )
{
struct student student1;
student1 = read_student ( )
print_student( student1);
read_student_p(student1);
print_student (student1);
}
struct student read_student( ) \\ A
{
struct student student2;
gets(student2.name);
scanf(“%d”,&student2.marks);
return (student2);
}
void print_student (struct student student2) \\ B
{
printf( “name is %s\n”, student2.name);
printf( “marks are%d\n”, student2.marks);
}
void read_student_p(struct student student2) \\ C
{
gets(student2.name);
scanf(“%d”,&student2.marks);

}



Related Links :

C Program to allocate Run time Memory For variable in C

C Program to allocate Run time Memory For variable in C


#include
#include
main()
{
int *base; \\ A
int i;
int cnt=0;
int sum=0;
printf("how many integers you have to store \n");
scanf("%d",&cnt);
base = (int *)malloc(cnt * sizeof(int));
printf("the base of allocation is %16lu \n",base);
if(!base)
printf("unable to allocate size \n");
else
{
for(int j=0;j<=cnt;j++)
*(base+j)=5;
}
sum = 0;
for(int j=0;j<=cnt;j++)
sum = sum + *(base+j);
printf("total sum is %d\n",sum);
free(base);
printf("the base of allocation is %16lu \n",base);
base = (int *)malloc(cnt * sizeof(int));
printf("the base of allocation is %16lu \n",base);
base = (int *)malloc(cnt * sizeof(int));
printf("the base of allocation is %16lu \n",base);
base = (int *)calloc(10,2);
printf("the base of allocation is %16lu \n",base);


}




Related Links :

Manually Memory Allocation By using MALLOC in C

Manually Memory Allocation By using MALLOC in C




#include
#include
main()
{
int *base;
int i;
int cnt=0;
int sum=0;
printf("how many integers you have to store \n");
scanf("%d",&cnt);
base = (int *)malloc(cnt * sizeof(int));
printf("the base of allocation is %16lu \n",base);
if(!base)
printf("unable to allocate size \n");
else
{
for(int j=0;j<=cnt;j++)
*(base+j)=5;
}
sum = 0;
for(int j=0;j<=cnt;j++)
sum = sum + *(base+j);
printf("total sum is %d\n",sum);
free(base);
printf("the base of allocation is %16lu \n",base);
base = (int *)malloc(cnt * sizeof(int));
printf("the base of allocation is %16lu \n",base);
base = (int *)malloc(cnt * sizeof(int));
printf("the base of allocation is %16lu \n",base);
base = (int *)calloc(10,2);
printf("the base of allocation is %16lu \n",base);


}


Related Links :

Recursive Function in C for addition of given two numbers

Recursive Function in C for addition of given two numbers





#include
int add(int pk,int pm);
main()
{
int k ,i,m;
m=2;
k=3;
i=add(k,m);
printf("The value of addition is %d\n",i);
getch();
}


int add(int pk,int pm)
{
if(pm==0) return(pk);
else return(1+add(pk,pm-1));
}



Related Links :

C Program to calculate length of given string in C without using STRLEN function

C Program to calculate length of given string in C without using STRLEN function



main ( )
{
char s1[6] = “abcde ”;
int cnt = 0;
cnt = cnt_str(s1);
printf( “ total characters are %d \n”, cnt);
}

int cnt_str(char s1[]);
{
int cn = 0;
while ( (cn < 6) && s1[cn]! = ‘\0’) cn++; return(cn); }

Related Links :

interchanging the values of string in C


main ( )
{
char * s1 = “abcd”;
char s2[] = “efgh”;
printf( “%s %16lu \n, s1, s1);
printf( “%s %16lu \n, s2, s2);
s1 = s2;
printf( “%s %16lu \n, s1, s1);
printf( “%s %16lu \n, s2, s2);
}





Related Links :

Program to explain Working of Union in C

Program to explain Working of Union in C





union marks \\ A
{
float perc; \\ B
char grade; \\ C
}
main ( )
{
union marks student1; \\ E
student1.perc = 98.5; \\ F
printf( “Marks are %f address is %16lu\n”, student1.perc, &student1.perc); \\ G
student1.grade = ‘A’’; \\ H
printf( “Grade is %c address is %16lu\n”, student1.grade, &student1.grade); \\ I
}



Related Links :

C Program to Sort the numbers and store them in file using user define function

C Program to Sort the numbers and store them in file using user define function

C Program to Sort the numbers and store them in file using user define function

#include

int bubble(int*,int);
void filewrite();
void avgmarks();
void fileprint();
void filesort();
void rollin();

/*********************** SORTING FUNCTION ***************************/
int bubble(int x[],int n)
{
int hold,j,pass,i,switched = 1;
for(pass = 0; pass < n-1 && switched == 1;pass++) { switched=0; for (j=0;jx[j+1])
{
switched=1;
hold = x[j];
x[j] = x[j+1];
x[j+1]=hold;
}
}
return(0);
}
/*********************** FILE WRITING FUNCTION ******************************/

void filewrite()
{
int roll,ch,mark;
char nam[50];
FILE *fp;
clrscr();
fp = fopen("student.txt","a");
printf("ENTER ROLL NUMBER, NAME , MARKS \n");
ch =1;
while(ch)
{
scanf("%d%s%d",&roll,&nam,&mark);
fprintf(fp,"%d %s %d\n",roll,nam,mark);
printf("\n\n press 1 to continue,0 to stop");
scanf("%d",&ch);
}
fclose(fp) ;
}
/******************** OUTPUTING DATA ON SCREEN***************/
void fileprint()
{
int marks[100],rollno[100],x[100],i;
char name[100][50];
FILE *fp;

clrscr();
fp = fopen("student.txt","r");
i=0;
printf("ROLLNO NAME MARK\n");
while(!feof(fp))
{
fscanf(fp,"%d %s %d\n",&rollno[i],&name[i],&marks[i]);
printf(" %d %s %d\n",rollno[i],name[i],marks[i]);
i=i+1;
}
fclose(fp);
printf("\n\n\nPRESS ANY KEY");
getch();

}
/******************* SORTING FILE ************************/
void filesort()
{ int marks[100],rollno[100],x[100],n,i,j;
char name[100][50];
FILE *fp,*fm;

fp = fopen("student.txt","r");
fm = fopen("marks.txt","w");
i=0;
while(! feof(fp))
{

fscanf(fp,"%d %s %d\n",&rollno[i],&name[i],&marks[i]);
x[i]= marks[i];
i=i+1;
}

n=i;

bubble(x,n);

for(i=0;i

Related Links :


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!