hello everyone can you please help me with my project.
Every time I run this program the average or b in this case is not decreasing.
the output I always get is
100
0
0
0
0
and so on.
It should be
100
90
80
...
please help.
#include<conio.h>
#include<stdio.h>
main()
{
int a=10,b,c=10;
for(c=10; c>=0; c--)
Your variable type is Interger and if you divide it will always return the same type.
So since Integer is unable to store floating point numbers 9/10 will result in 0.
You either have to change the variable types of your a,b,c to float or double or use a cast
when dividing.