How can I translate python to code in c | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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