app/site-content/proposals/2009/08/06/c_.c
changeset 8 294ff7ac9cb6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/site-content/proposals/2009/08/06/c_.c	Thu Aug 06 20:20:36 2009 +0530
@@ -0,0 +1,27 @@
+#include <stdio.h>
+
+main()
+{
+
+  int n, count = 1;
+  float x, sum = 0,average;
+  do {
+    printf("how many numbers? ");
+    scanf("%d", &n);
+    sum = 0;
+    count = 1;
+    while (count <= n)   {
+      printf("x = ");
+      printf("\n(to end program, enter 0 for x): ");
+      scanf("%f", &x);
+      if (x == 0) 
+        break;
+      sum += x;
+      ++count;
+    }
+    average = sum/n;
+    printf("\nthe average is %f\n", average);
+  } while (x != 0); 
+}
+
+