You mix 2 things: defining 4 sets and reading them from input (as I understood from your “using scanf
“).
(Reading them from input makes no problem as new read values overwrite old.)
Defining 4 sets in advance may be simply done by arrays:
float as[4], bs[4], cs[4]; // as[0], bs[0], cs[0] is the 1st set, etc.
float a , b , c ;
// Assigning values to sets: as[0] = ...; bs[0] = ..., cs[0] = ...;
as[1] = ...; bs[1] = ..., cs[1] = ...;
......................................
......................................
// or initialize them directly in the previous declaration, e.g.
// float as[] = {1, 4, -2, 3},
// bs[] = {0, 5, 1, -1},
// cs[] = {2, -4, 1, 2};
for (int i; i < 4; ++i)
{
a = a[i];
b = b[i];
c = c[i];
// Code (or a function call) for computing and printing result(s) from a, b, c
}
1
solved How to solve quadratic equations in C, using 3 coefficients?