- #1
Naldo6
- 102
- 0
Hi, i have did my program ccorrectly, but my profesor ask me to do with arrays and i don't know how to do thisprogram wuth arrays. Can anyone helps please?... I talk with my profesor and see my prgram, and told me that it is all ok , but the only mistake is that i don't use arrays how the work is supossed to be done...
Little of the instructions...
This is a program to show the depreciation value of an item at some porcentage during the first 10 years. If the value of the item at the end of the year is less than 72% of the orignal value, must show "Value under Interested". You Must validate the entry data. Do it using arrays.
# include <stdio.h>
# include <math.h>
void main()
{
int year;
float valor,valorinicial,porciento,depreciacion;
printf("\nPrograma Para Determinar Depreciacion De Un Equipo\n\n");
do{
printf("Entre Valor Del Equipo:\n$");
scanf("\n%f",&valorinicial);
}while(!(valorinicial>0));
do{
printf("\nEntre Nuevamente Valor Del Equipo:\n$");
scanf("\n%f",&valor);
}while(!(valorinicial==valor));
do{
printf("\nEntre El Porciento De Depreciacion:\n");
scanf("\n%f",&porciento);
}while(!(porciento>=0));
for(year=1;year<=10;year++)
{
depreciacion=valor*porciento/100;
valor=valor-valor*porciento/100;
if(valor>=.72*valorinicial)
printf("\nAl Year %i La Depreciacion= $%.2f y Valor Nuevo= $%.2f\n\n",year,depreciacion,valor);
else
printf("Al Year %i Valor Por Debajo De Lo Deseado\n\n",year);
}
}
Little of the instructions...
This is a program to show the depreciation value of an item at some porcentage during the first 10 years. If the value of the item at the end of the year is less than 72% of the orignal value, must show "Value under Interested". You Must validate the entry data. Do it using arrays.
# include <stdio.h>
# include <math.h>
void main()
{
int year;
float valor,valorinicial,porciento,depreciacion;
printf("\nPrograma Para Determinar Depreciacion De Un Equipo\n\n");
do{
printf("Entre Valor Del Equipo:\n$");
scanf("\n%f",&valorinicial);
}while(!(valorinicial>0));
do{
printf("\nEntre Nuevamente Valor Del Equipo:\n$");
scanf("\n%f",&valor);
}while(!(valorinicial==valor));
do{
printf("\nEntre El Porciento De Depreciacion:\n");
scanf("\n%f",&porciento);
}while(!(porciento>=0));
for(year=1;year<=10;year++)
{
depreciacion=valor*porciento/100;
valor=valor-valor*porciento/100;
if(valor>=.72*valorinicial)
printf("\nAl Year %i La Depreciacion= $%.2f y Valor Nuevo= $%.2f\n\n",year,depreciacion,valor);
else
printf("Al Year %i Valor Por Debajo De Lo Deseado\n\n",year);
}
}