How can I translate python to code in c | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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))

1st Oct 2020, 9:24 AM
DAVID ISMAEL BARRON RUIZ
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.
1st Oct 2020, 5:25 PM
Brian
Brian - avatar
+ 1
by knowing C.
1st Oct 2020, 9:29 AM
Rohit