First we make a pseudocode similar to this to guide us through the class:
count = 0 a = 0 p = 1
print 0.1
while (count \u0026lt;100)
do
n = a + p
print n
a = p, p = n count + +
An algorithm in C would look like:
# include \u0026lt;stdio.h>
# include \u0026lt;stdlib.h>
main () {
/ * Defining variables, C is a numerical count * /
int A = 0, B = 1, C = 3, N;
printf ("% d \\ n% d \\ n", A, B )
while (C \u0026lt;= 47)
{N = A + B;
printf ("% ld \\ n", N);
/ * the numbers are run on the variables * /
A = B, B = N;
/ * Increase the count * /
C++;
}
system ("pause");
}
0 comments:
Post a Comment