Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.facebook.com/AminproPastebin
- #include <stdio.h>
- int main()
- {
- float x=0;
- float total;
- int count=1;
- int avgcount=0;
- int numint =0;
- printf("Please enter the number of intergers");
- scanf("%d", &numint);
- while(count<=numint){
- printf("Enter the %d's interger", count);
- scanf("%f", &x);
- if(x>0){
- total = x + total;
- avgcount ++;
- count ++;
- }
- else{count++;}
- }
- total = total/avgcount;
- printf("The average is %.2f\n", total);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement