Advertisement
Kl43z

Repetitiva / --...--

Sep 22nd, 2014
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4. int prom=0,nota,cont=0;
  5. float promf=0;
  6. printf("Bienvendio al programa para calcular el promedio del curso.\n");
  7. printf("Cuando desee dejar de ingresar notas, por favor ingrese 0.\n\n");
  8. while(nota!=0){
  9. printf ("Ingrese la nota del alumno número %d: ", cont+1);
  10. scanf ("%d", &nota);
  11. if (nota>=10 && nota<=70 && nota!=0){
  12. prom=prom+nota;
  13. cont=cont+1;
  14. }
  15. else if (nota!=0){
  16. printf("Ingrese un numero de 2 cifras, que se encuentre entre el 10 y el 70 Ej \"55\"\n");
  17. continue;
  18. }
  19. }
  20. if (cont!=0){
  21. promf=(float)prom/cont;
  22. printf("El Promedio de notas del curso corresponde a un %.2f\n", promf);
  23. }
  24. else {
  25. printf("Usted no ingresó notas.\n");
  26. }
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement