Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Header file



Comment



Test expression



Iterative statement



Specifer




Calculate sum and average untill ( 00 ) is encountered




// AHF C PROGRAM SOLVING

//solving here ITERATIVES STATEMENTS type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int number; int sum= 0,count= 0; float ave; pf("\nEnter any number. Enter 00 to exit........\t: "); scanf("%d",&number); //this input will start the loop while(number!=00) //ending condition of the loop { sum+=number; count++; //counting for total given input pf("\nEnter any number. Enter 00 to exit........\t: "); scanf("%d",&number); //this input will stop the loop } ave=(float)sum/count; //for average calculation //printing the required statement pf("\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"); pf("\nThe summation of given input number is: %d",sum); pf("\nThe average of given input number is: %f",ave); pf("\nTotal given input= %d",count); return 0; }
OUTPUT:


© 2018 - All rights reserved