Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Comment



" ; " after loop



Iterative statement



Specifer



Header file




Print largest and smallest number untill (-1) 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 small=10000,count= 0,large= -10000; //declaring variable taking a sample statement 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 { large=number>large?number:large; small=number<small?number:small; count++; //counting for total given input pf("\nEnter any number. Enter 00 to exit........\t: "); scanf("%d",&number); //this input will stop the loop } //printing the required statement pf("\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"); pf("\n\nThe largest number among %d numbers is: %d",count,large); pf("\n\nThe smallest number among %d numbers is: %d",count,small); pf("\nTotal given input= %d",count); return 0; }
OUTPUT:


© 2018 - All rights reserved