-
flowchart. Help!!!
Anyone know how to write a flowchart for this code? I'm stuck here.
min_number=var_array[0];
for(i=0 ; i<6 ; i++)
{
if (var_array[i] < min_number) min_number=var_array[i];
}
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf(" The minimum value is %d \n", min_number);
Thanks in advance...
-
I assume you have problems making the flowchart for the for-loop. I'll do it in text, you can draw the chart yourself.
Code:
initialisation -> check == TRUE -> loop-body -> increase counter -> (now back to the check)
-> check == FALSE -> end of loop
-
1 Attachment(s)
Quote:
Code:
min_number=var_array[0];
for(i=0 ; i<6 ; i++)
{
if (var_array[i] < min_number)
min_number=var_array[i];
};
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf(" The minimum value is %d \n", min_number);
FLOWCHART
----------------
see attached gif.
WHAT IT DOES
-------------------
this code simply finds the smallest number in the list of 6 entries and outputs it at the end. It's missing a couple of things.
-
i would think that the for-loop statement should be in a way, right, how about this example ? hopefully this kind of graphic look beautiful anyway.
Code:
at the for-loop section,
|
|
|
|
i = 0;
|< --------------------------------------------------
| |
i < 6? |
| |
|-------- <accordingly to the "yes" way >---|
no |
|
|
printf ....
|
|
|
end
:: HOPE fully this graphic is good.
:D
tagged by Salem
PS - change the tabs to spaces, then edit your post