twitterfacebookgoogle plusrss feedemail

How to show Average of odd numbers bellow a range using C programming


To display Average of odd numbers bellow a range using C programming

just copy the bellow code and paste it to your TurboC software. And then run the program.




void main()
{
  int r,i,c,t;
  float a;
  clrscr();
  printf("Enter the range : ");
  scanf("%d",&r);
  i = 1;
  c = 0;
  t = 0;
  while (i<=r)
  {
     if (i%2!=0)
     {
        t=t+i;
        c++;
     }
     i++;
  }
  a=t/c;
  printf("\n The average of odd numbers bellow %d is : %f",r,a);
  getch();
}


Kindly Share This Post »»

Author Box by ENGINEER's TIPS

About the Author

I am Arpan Paramanik From India and i am the founder of the blog ENGINEER's TIPS.I Very Much interest in blogging by reading articles online. Mine thirst for learning latest web technologies like HTML, CSS, C, C++ and JavaScript equipped me with an art of web designing. I am now a good designer…’

0 comments:

Post a Comment

 

Wikipedia Search

Search results

Total Pageviews

Recent Comments

If you are facing any problem in this site, or any link is not working then please

Contact us

Name

Email *

Message *

 
To Top To Bottom Auto Scroll Stop Scroll