123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
--------------------------------------------------------------------------------

Program to solve a 3 Variable Linear Equation.

--------------------------------------------------------------------------------

Description : Solves any 3 variable linear equation.


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
main()
{
clrscr();
float a,b,c,d,l,m,n,k,p,D,q,r,s,x,y,z;
printf("PROGRAM TO SOLVE THREE VARIABLE LINEAR SIMULTANEOUS
EQUATIONS
<BR>);
printf("The equations are of the
form:

ax+by+cz+d=0
lx+my+nz+k=0
px+qy+rz+s=0
<BR>);
printf("Enter the coefficients in the order a,b,c,d,l,m,n,k,p,q,r,s<BR>);
scanf("%f%f%f%f%f%f%f%f%f%f%f%f",&a,&b,&c,&d,&l,&m,&n,&k,&p,&q,&r,&s);
printf("
The equations you have input are:
<BR>);
printf(" %.2f*x + %.2f*y + %.2f*z + %.2f = 0<BR>,a,b,c,d);
printf(" %.2f*x + %.2f*y + %.2f*z + %.2f = 0<BR>,l,m,n,k);
printf(" %.2f*x + %.2f*y + %.2f*z + %.2f = 0
<BR>,p,q,r,s);

D = (a*m*r+b*p*n+c*l*q)-(a*n*q+b*l*r+c*m*p);
x = ((b*r*k+c*m*s+d*n*q)-(b*n*s+c*q*k+d*m*r))/D;
y = ((a*n*s+c*p*k+d*l*r)-(a*r*k+c*l*s+d*n*p))/D;
z = ((a*q*k+b*l*s+d*m*p)-(a*m*s+b*p*k+d*l*q))/D;

printf("The solutions to the above three equations are :
<BR>);
printf(" x = %5.2f
y = %5.2f
z = %5.2f<BR>,x,y,z);
getch();
return 0;
}
Program to find your Day of Birth given Date of Birth.

--------------------------------------------------------------------------------

Description : Gives exact day of birth if you are born anywhere in the 20th century. Also works fine for previous centuries.

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>

main()
{
clrscr();
int d,m,y,year,month,day,i,n;
printf("Enter how many times you want to run this program : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("

Enter the date : ");
scanf("%d%d%d",&d,&m,&y);
if( d>31 || m>12 || (y<1900 || y>=2000) )
{
printf("

INVALID INPUT<BR>);
getch();
exit(0);
}
year = y-1900;
year = year/4;
year = year+y-1900;
switch(m)
{
case 1:
case 10:
month = 1;
break;
case 2:
case 3:
case 11:
month = 4;
break;
case 7:
case 4:
month = 0;
break;
case 5:
month = 2;
break;
case 6:
month = 5;
break;
case 8:
month = 3;
break;
case 9:
case 12:
month = 6;
break;
}
year = year+month;
year = year+d;
day = year%7;
switch(day)
{
case 0:
printf("

Day is SATURDAY<BR>);
break;
case 1:
printf("

Day is SUNDAY<BR>);
break;
case 2:
printf("

Day is MONDAY<BR>);
break;
case 3:
printf("

Day is TUESDAY<BR>);
break;
case 4:
printf("

Day is WEDNESDAY<BR>);
break;
case 5:
printf("

Day is THURSDAY<BR>);
break;
case 6:
printf("

Day is FRIDAY<BR>);
break;
}
}
getch();
return 0;
}
3
 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG