Why My code is Giving no Output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why My code is Giving no Output?

Please Check The Code... You will Get further info (Like how to Put inputs and All..) in the Code Only... Help..!!! https://code.sololearn.com/cBbmGMZqYfvF/?ref=app

16th Apr 2019, 1:45 PM
Priyesh Arya
Priyesh Arya - avatar
2 Answers
+ 2
scanf needs & before a[] https://beginnersbook.com/2014/01/2d-arrays-in-c-example/ https://stackoverflow.com/questions/44789110/getting-values-for-an-array-using-scanf-function-in-c a[i][j] //this hold the pointer of element in the array &a[i][j] //this is the place of the value of the element in the array scanf("%f",&a[i][j]); scanf("%f",&b[i]);
16th Apr 2019, 7:10 PM
sneeze
sneeze - avatar
+ 1
First of all take input then scan the value. store it by using "&" without "&" it will show you the garbage value... give upvote if I solved your problem... #include <stdio.h> int main() { int i,j,k; float a[5][5], b[5], x, y, z, q, p; printf ("Hello, assume linear equation as (ax + by = c)\n"); for(i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { printf ("Enter the co-efficients of x and y respectively:\t"); scanf("%f",&a[i][j]); } printf ("\n"); } for(k = 0; k < 2; k++) { printf ("Enter constant values respectively:\t"); scanf("%f",&b[k]); } x = (a[0][0] * a[1][1]) - (a[1][0] * a[0][1]); y = (b[0] * a[1][1]) - (b[1] * a[0][1]); z = (a[0][0] * b[1]) - (a[1][0] * b[0]); p=y/x; q=z/x; printf ("\nDelta=\t%f",x); printf ("\nDeltax=\t%f",y); printf ("\nDeltay=\t%f",z
17th Apr 2019, 4:57 PM
Sumit Bikram Maity
Sumit Bikram Maity - avatar