Skip to main content

Program_function_02


Adding two Integer number using Function.

/* Adding two Integer number using Function.*/
 #include <stdio.h>
int sum( int x, int y); /* function prototype */
int sub( int x, int y);
int mul( int x, int y);
int div( int x, int y);
 /* function main begins program execution */
 void main( )
 {
    sum (5,7);
    sub (10,5);
    mul (10,5);
    div (10,5);

 } /* end main */
/* Function maximum definition */
/* x, y and z are parameters */
int sum( int x, int y)
{
    printf ("%d", x+y);
    getch();
} /* end function maximum */
int sub( int x, int y)
{
    printf ("%d", x-y);
    getch();
}
int mul( int x, int y)
{
    printf ("%d", x*y);
    getch();
}
int div( int x, int y)
{
    printf ("%d", x/y);
    getch();
}
Output:


Comments

Popular posts from this blog

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...

C Program01 Chap01: Area of Squre

/*Prime.Chapter_01/17 Write a program for Area of Squre*/   //document #include<stdio.h>    //Header file #include<conio.h>   //Header file Preprocessor Directive #define N 10        //Symbolic constant     void main()     //main program starts {     int area;       //variable declaration     area = N*N;     //process stmt      printf("Area of square:\n"); // o/p stmt     printf("%d", area);            // to show the output visible     getch();     return 0; }   // Program ends.