You can deal with that problem by using the [plain] tags. Example: Array[i]better.
now, why do you set N = 5 and then check N?
will the test Array\[i\] < Smallest ever be true the first time through the loop?
edit: brackets do funny things, ignore the "\"
Look at new flow chart with explanationsHow does N change from 5 to 0? What box in your flowchart changes the value of N other than the very first box after Start?
You are doing what you WANT the code to do, not what the flowchart is actually doing. STOP THAT!
Look at the line when i=2. You have 2 <= 4 as True. Fine. But then you change the value of Smallest? Why? That's what you WANT to happen. But look at your flowchart! If Array < Smallest (and note you have '<' and not '<=') then the Yes arrow takes you AROUND the box that updates the value of Smallest.
You have in your table a check on N=5 each time through the loop, but that check (which is pretty meaningless to begin with) is executed ONCE before the loop ever starts.
Then your table never includes the check on i<N, which is the check that determines whether you stay in the loop.
You don't stand a chance of writing valid code if you can't walkthrough a piece of code and do what it says instead of what you want it to do.

N = 5 this check length of array. this check only if there are only five element store in array. suppose the array of length is 5 but there are only four element store in array in this case. This will not check the array element.Much better.
No consider the following items (most of which have been mentioned previously)
1) What is the point of checking if N is equal to 5 before the loop? Since you have just set N=5 prior to this, is there any chance the test can fail? Even if there were, does it make since to print No Data if N is not equal to 5 (say you changed the first block to set N=4)?
if one element repeat more than one, that case use equal operator2) Does it make sense to update Smallest when the value in the array is equal to it? What purpose does that serve?
In first case, I assume that first element of array is smallest. but the smallest number can be anyone in array elementSince you set the initial value of Smallest to Array[0] before the loop, does it make sense to check it again during the first pass through the loop?
Keep in mind that N is just a variable. It's value is equal to the number of data elements in the array only because YOU set it equal to 5 in the first block of your flowchart. Because it is a variable that you've set to 5, there is zero chance (barring a cosmic ray upsetting a register or some other extremely low probability event) that it will not be equal to 5 when you do the check. So why do the check? It's different if you are asking the user to enter the number of data items, because then you don't know what they are going to enter. But even then it makes no sense to perform your check against N being equal to exactly 5.N = 5 this check length of array. this check only if there are only five element store in array. suppose the array of length is 5 but there are only four element store in array in this case. This will not check the array element.
Why? If Smallest is equal to 42 and Array[3] is also equal to 42, why overwrite Smallest with 42 when it is already 42?if one element repeat more than one, that case use equal operator
So? After setting Smallest equal to Array[0], what is the purpose of checking if Array[i] is less than or equal to Smallest when i = 0?In first case, I assume that first element of array is smallest. but the smallest number can be anyone in array element
I was confuse by looking old post #25. I have redraw flow chart. and I think this is answer of all questionsKeep in mind that N is just a variable. It's value is equal to the number of data elements in the array only because YOU set it equal to 5 in the first block of your flowchart. Because it is a variable that you've set to 5, there is zero chance (barring a cosmic ray upsetting a register or some other extremely low probability event) that it will not be equal to 5 when you do the check. So why do the check? It's different if you are asking the user to enter the number of data items, because then you don't know what they are going to enter. But even then it makes no sense to perform your check against N being equal to exactly 5
Why? If Smallest is equal to 42 and Array[3] is also equal to 42, why overwrite Smallest with 42 when it is already 42?
So? After setting Smallest equal to Array[0], what is the purpose of checking if Array[i] is less than or equal to Smallest when i = 0?

You really need to pay attention to detail (especially since programming is all about careful attention to minute details!).Does it make any sense?
View attachment 136413
+1 .. and not the first time that tendency has been pointed out. It is hard to keep up.You seem to be making random changes without intent, just hoping that, at some point, it will all just happen to work.
+1 to that. over the years I've degenerated into using a kind of deviant C pseudo-code but it doesn't have to "compile" or even have pedantic correctness. I save that stage for actual code.Perhaps the flow charts are not the best way to plan or learn algorithms (e.g. in the book Introduction to Algorithms these are not used).
I would start writing on a piece of paper a simple random series, e.g. {10, 8, 11, -4, 7, 5, 12, 1} then reasoning on the steps to use to order it.
simozz
#include <stdio.h>
#include <stdlib.h>
/*
Simple macro for inspecting *integer* values
*/
#define SHOW(expression) SHOW_(#expression, expression)
/*
Function invoked by macro (not used directly in code)
*/
int SHOW_(const char* text_of_expression, int value_of_expression)
{
printf("%s :: %d\n", text_of_expression, value_of_expression);
return value_of_expression;
}
/*
A little helper function to randomly populate an integer array
*/
#include <time.h>
void randomize_integer_array(int* data, size_t length, int low, int high)
{
static int initialized = 0;
if(!initialized)
{
srand(time(NULL));
initialized = 1;
}
int range = (high - low) + 1;
for(size_t index = 0; index < length; ++index)
{
int value = rand();
if(range != 0)
value %= range;
data[index] = low + value;
}
}
/*
Example program using macro to examine values step-by-step...
*/
int main(void)
{
const size_t N = 5;
int a[N];
randomize_integer_array(a, N, 30, 50);
puts("~ Values ~");
for(size_t i = 0; i < N; ++i)
SHOW(a[i]);
/*
First attempt to find the smallest number in an array:
*/
puts("BEGIN");
int smallest = a[0];
SHOW(N);
SHOW(smallest);
puts("LOOP START");
for(size_t i = 0; i < N; ++i)
{
SHOW(i);
SHOW(a[i]);
if(SHOW(a[i] > smallest))
{
SHOW(smallest = a[i]);
}
SHOW(smallest);
}
puts("LOOP COMPLETE");
SHOW(smallest);
puts("FINISHED");
/*
Repeat: inspect output from above, fix code logic accordingly...
*/
return 0;
}