Wednesday, 10 September 2014

Find maximum value using C programming Language with Example

Maximum value finding code in C programming language. This largest value calculation code is based on integer value detecting. Variables and functions also declared as an Integer. This sample source code is ease to use. The code is given below.  

This C program is used to find the maximum value number in the list of values entered by user. Program is based on conditional statements of basic if ((num>max)).

Q: Write a C program to find maximum integer value from the given numbers.

//Header files
//Global variables
int findmax(int totali,...);
int main()
    int max; //Program variables
    clrscr(); //Function to clear previous function
    max=findmax(6,23,45,24,2,56,43); //Maximum value
    printf("\n%d",max);//Display function
    return 0;
int findmax(int total,...)
    va_list ptr;
    int i,max,num;
    for (i=2;i<=total;i++) //Looping statement
        if (num>max)
    return max;

No comments:

Post a comment

Note: only a member of this blog may post a comment.