Hi! I need your help!! My teacher wants us to create flowchart with this code from turbo c :

#include<stdio.h>
main()
{
int grade;
clrscr();
printf("Enter Grade:");
scanf("%d",&grade);
if(grade<=74 && grade>=70)
printf("Sorry, You Failed!");
else if(grade>=75 && grade<=100)
printf("Congratulations! You Passed!");
else if(grade>=101 && grade>=101)
printf("Invalid Grade");
else if(grade<=69&&grade<=69)
printf("Invalid Grade");
getch();
}

pls help me! I tried to draw a flowchart and when i passed it to my teacher, he gave it back to me because it s wrong.


and another one:

#include<stdio.h>
#include<conio.h>
int m;
main()
{
clrscr();
printf("Enter Number:");
scanf("%d",&m);
switch(m)
{
case 1:
printf("\nJanuary: 31 Days");

break;

case 2:
printf("\nFebruary: 28 Days");

break;

case 3:
printf("\nMarch: 31 Days");

break;

case 4:
printf("\nApril: 30 Days");

break;

case 5:
printf("\nMay: 31 Days");

break;

case 6:
printf("\nJune: 30 Days");

break;

case 7:
printf("\nJuly: 31 Days");

break;

case 8:
printf("\nAugust: 31 Days");

break;

case 9:
printf("\nSeptember: 31 days");

break;

case 10:
printf("\nOctober: 30 Days");

break;

case 11:
printf("\nNovember: 31 Days");

break;

case 12:
printf("\nDecember: 31 Days");

break;

default:
printf("\nMonth is not available");
}
getch();
}

so i really really need your help guys. :'( I don't have any idea how to do it correctly.

Advance thanks to all of you.

xoxo

Dani AI

Generated

For : the two programs you posted explain why the flowchart was returned — the grade program has overlapping/redundant tests so branch order becomes ambiguous, and the month switch prints incorrect day counts for several months. As suggested, showing the actual flowchart would make it easier to point out drawing mistakes. Also, and are right that designing the flow logic first (validation -> decisions -> output) keeps the chart simple and correct.

Correct, minimal logic for the grade problem (validate first, then decide):

read grade
if grade < 0 or grade > 100:
    print "Invalid Grade"
else if grade >= 75:
    print "Congratulations! You Passed!"
else:
    print "Sorry, You Failed!"

For the month program: a few case outputs in the original are wrong — September and November have 30 days, October has 31. A cleaner flow is validate month number, then map groups of months to their day counts. Example:

read month
if month < 1 or month > 12:
    print "Month is not available"
else:
    if month in {1,3,5,7,8,10,12}: print "31 days"
    else if month in {4,6,9,11}: print "30 days"
    else: print "February: 28 days (29 if leap year)"

Flowchart drawing tips: put input and validation at the top, use diamonds for decisions (label branches true/false), parallelograms for I/O, and rectangles for simple processing. Validate ranges before branch-specific checks to avoid overlapping conditions. Group identical outputs to reduce duplicate diamonds (e.g., group all 31-day months). Test the flowchart with boundary values (69, 70, 74, 75, 100, 101; months 2, 9, 10, 11) to confirm each path is covered. Low-level calls like clrscr() or getch() are not needed on a logic flowchart unless the assignment explicitly asks for them.

Recommended Answers

All 3 Replies

So you first made the code and then made a flowchart ? How funny..

Anyway, show us the flowchart that you've made and we'll suggest some corrections

That is odd. Back when I was programming in college, you were not allowed to write any code until the flowcharts and pseudo-code were done. They also had to be approved by the teacher.

That is odd. Back when I was programming in college, you were not allowed to write any code until the flowcharts and pseudo-code were done. They also had to be approved by the teacher.

No shit. Just like you don't design the plumbing after the house has been built. Or something along those lines. lol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.