include include void main() { int a, b, c, d, e, f, dthuc; float x, y; printf( Nhap vao cac he so a,b,c,d,e,f : ); scanf(%d%d%d%d%d%d, a, b, c, d, e, f); dthuc = bd ea; if (dthuc = 0) { y = (float)(cdaf)dthuc; x = (float)(bfce)dthuc; printf(Nghiem x = %f, y = %f, x, y); } else printf( He phuong trinh vo ngiem.); getch(); }
Trang 1Giải hệ phương trình bậc nhất ứng dụng ngôn ngữ C
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, c, d, e, f, dthuc;
float x, y;
printf("\nNhap vao cac he so a,b,c,d,e,f : "); scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f); dthuc = b*d - e*a;
if (dthuc != 0)
{
y = (float)(c*d-a*f)/dthuc;
x = (float)(b*f-c*e)/dthuc;
printf("Nghiem x = %f, y = %f", x, y);
}
else
printf("\nHe phuong trinh vo ngiem.");
getch();
}