0
How can I translate python to code in c
ap = 0 rep = 0 p = 0 a = 0 cal = 0 while 0 <= cal <= 100: cal = float(input("Inserte calificación: ")) if 60 <= cal <= 100: ap += 1 a += 1 p = p + cal elif 0 <= cal < 60: rep += 1 a += 1 p = p + cal elif cal < 0: print("Calificación invalida") cal = 0 p = p / a print("Proceso terminado con " + str(a) + " alumnos totales, " + str(rep) + " alumnos reprobados, " + str(ap) + "alumnos aprobados y un promedio de clase de " + str(p))
2 Answers
+ 2
Add import statement(s), add a semicolon to the end of every statement, surround indentation with braces, replace input with scanf, surround conditionals with parentheses, convert compound conditionals into simple ones, remove colons from branching statements, declare explicit variable types, replace print with printf, reformat string handling within print() to be compatible with printf, replace elif with else if, and then start troubleshooting. Hope it works out for you.
+ 1
by knowing C.