Home > Back-end >  I made two assignments but teachers require use Pointers to solve
I made two assignments but teachers require use Pointers to solve

Time:12-15

 # include 
# include
Void f1 (int a, b int, int) c;
Void f2 (int a, b int, int) c;
Void f3 (int a, b int, int) c;
Int main ()
{
int a,b,c;
Double t;
Printf (" please enter a b c \ n ");
The scanf (" % d % d % d ", & amp; A, & amp; B, & amp; c);
Printf (" the original equation for dx ^ 2 dx + + % % % d=0 \ n ", a, b, c);
T=b * * a * b - 4 c.
If (t> 0)
{
F1 (a, b, c);
}
If (t==0)
{
F2 (a, b, c);
}
If (t<0)
{
F3 (a, b, c);
}
return 0;
}
Void f1 (int a, b int, int) c
{
Double x1, x2, t;
T=b * * a * b - 4 c.
X1=(a - b + SQRT (t))/(2 * a);
X2=(a - b - SQRT (t))/(2 * a);
Printf (" x1=% f, x2=% f ", x1, x2);
}
Void f2 (int a, b int, int) c
{
Double x1, x2, t;
T=b * * a * b - 4 c.
X1=(a - b + SQRT (t))/(2 * a);
X2=x1;
Printf (" x1 x2==% f ", the x1);
}
Void f3 (int a, b int, int) c
{
Printf (" no real root \ n ");
}

 # include & lt; Stdio. H> 
Int main ()
{
Int judge (int n);
int x;
Printf (" input a integer: ");
The scanf (" % d ", & amp; X);
If (judge (x))
Printf (" % d is a prime \ n ", x);
The else
Printf (" % d is not a prime \ n ", x);
return 0;
}
Int judge (int n)
{
Int I, k=n/2;
If (n==1)
return 0;
for(i=2; i<=k; I++)
If I (n %==0)
return 0;
return 1;
}

Or am I can't understand what is the use of the education of pointer only feel redundant because has done box also don't know how to change a good hope bosses give directions
  • Related