Skip to main content

Program_function_01

Using Function: Finding the maximum of three integers.

/* Fig. 5.4: fig05_04.c
    Finding the maximum of three integers */
 #include <stdio.h>
int maximum( int x, int y, int z ); /* function prototype */

 /* function main begins program execution */
 int main( void )
 {
    int number1; /* first integer */
    int number2; /* second integer */
    int number3; /* third integer */

    printf( "Enter three integers: " );
    scanf( "%d%d%d", &number1, &number2, &number3 );

    /* number1, number2 and number3 are arguments
       to the maximum function call */
    printf( "Maximum is: %d\n",  );
    return 0; /* indicates successful termination */
 } /* end main */

/* Function maximum definition */
/* x, y and z are parameters */
int maximum( int x, int y, int z )
{
   int max = x; /* assume x is largest */

   if ( y > max ) { /* if y is larger than max, assign y to max */
      max = y;
   } /* end if */

if ( z > max ) { /* if z is larger than max, assign z to max */
      max = z;

} /* end if */

   return max; /* max is largest value */
} /* end function maximum */
Output:


Comments

Popular posts from this blog

Class_3::::>>>>HTML Link,Image & Image Link

<!DOCTYPE html> <html>   <head>     <title> Class_3::::>>>>HTML Link,Image & Image Link </title>     </head>       <body>         <a href="index.html" target="_blank" style="text-decoration:none;"> Mypages</a><br /> <a href="http://www.tbsbd.blogspot.com" target="_blank"> GoogleHomePages</a><br /> <a href="mailto:#" target="_blank"> Mail Of Admin</a><br /> <a href="http://www.tbsbd.blogspot.com" target="_blank"> <img src="logo02.gif" alt="This Logo" /> </a>     </body> </html>

Managing a Simple Mailing List

This hour provides the first of several hands-on, small projects designed to pull together your PHP and MySQL knowledge. In this hour, you'll learn the methods for creating a managed distribution list, which can be used to send out newsletters or anything else that you want to send, to a list of email addresses in a database. The mailing mechanism you'll use in this hour is not meant to be a replacement for mailing list software, which is specifically designed for bulk messages. The type of system you'll build in this lesson should be used for only small lists of fewer than a few hundred email addresses. In this hour, you will learn how to Create a subscribe/unsubscribe form and script Create a front end for sending your message Create the script that sends your message Developing the Subscription Mechanism You learned in earlier lessons that planning is the most important aspect of creating any product. In this case, think of the element...

How to make a Calculator -(Part-4) of using Visual Basic2010

Calculator  - Visual Basic 2008 / 2010 Page 4 The Zero Button: Double click on the zero button and add the following highlighted code: Private Sub Button14_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click If Button1.Text = Label1.Text Then Button1.Text = "0." ElseIf Button1.Text = "0." Then Button1.Text = "0." ElseIf Button1.Text = "0" Then Button1.Text = "0." ElseIf Button1.Text = Label3.Text Then Button1.Text = "0." Else Button1.Text = Button1.Text & "0" End If End Sub The Decimal Button: Double click on the decimal button and add the following highlighted code: Private Sub Button15_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click If Button1.Text = "0." Then Button1.Text = "." ElseIf Button1.Text = Label3.T...