Thursday, July 9, 2009

Write a program in C using array that prints the difference of the five input values from the lowest.?

Program in C using one-dimensional array that determines the lowest value among five input values from the keyboard and prints the difference of each value from the lowest.

Write a program in C using array that prints the difference of the five input values from the lowest.?
Try the following code. It should work..





#include %26lt;stdio.h%26gt;


main()


{


int inp[5],i,min;





printf("Enter 5 values--%26gt;");





for (i=0; i%26lt;5;i++)


{


scanf("%d", %26amp;inp[i]);


}





min=inp[0];


for (i=1; i%26lt;5; i++)


{


if (inp[i] %26lt; min)


min=inp[i];


}


printf("Minimm=%d\n",min);





for(i=0; i%26lt;5;i++)


{


printf("%d\n", inp[i]-min);


}





}
Reply:Do you have an example you have tried? I would be glad to help you troubleshoot something, but good luck getting someone to do your work for you.


No comments:

Post a Comment