bucle for, no me corre
|
| #1 (permalink) |
| Nuevo miembro Registrado: enero 2009 Mensajes: 24 | #include<stdio.h> #include<conio.h> main() { int i,VP[6],sumaP; i=0; while (i<6) { printf("\n Ingrese Porcentaje: "); scanf("%d",&VP[i]); if((VP[i]<5)||(VP[i]>30)) printf ("ERROR, el Porcentaje debe estar entre 5% y 30%"); else i++; } for (i=0;i==5;i++) { sumaP=sumaP+VP[i]; } VP[6]=100-sumaP; printf("\n El último porcentaje es: %d",&VP[6]); clrscr(); getch(); return 0; }//fin main me gustaria q alguien me ayudara.. el bucle for no me quiere correr no hace nada despues de validar |
| | |
|
| #2 (permalink) |
| Ex-miembro Registrado: octubre 2008 Mensajes: 431 | Holas, Allí esta el problema, debería ser: Código: for (i=0;i<=5;i++)
{
sumaP=sumaP+VP[i];
}
Saludos |
| | |
| Herramientas | |
| Estilo | |
| Tema | Iniciado por | Foro | Respuestas | Último mensaje |
| Bucle mientras | rojiblanc0 | Programación | 10 | 11 abr 2010 20:41 |
| bucle en test drive | Kifli | Juegos | 2 | 21 mar 2008 00:40 |
| no corre el virtualbox | Franklindsfranco | Software para Linux | 7 | 16 feb 2008 00:05 |
| Corre, Corre......... | chicho terremoto | Un poco de todo | 0 | 01 ene 2008 14:36 |
| porque Ares corre lento? | gunnnnnnsssssnn | P2P | 5 | 05 dic 2007 09:54 |


Modo lineal