File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+
4+ // Function prototype
5+ // syntax ---> function-name (arguments);
6+ // gives assurity that required function is present int the code
7+
8+ // int sum(int a, int b); // -- Acceptable
9+ // int sum(int a, b); // -- Not Acceptable
10+ int sum (int , int ); // -- Acceptable
11+
12+ // void g(void); acceptable//
13+ void g ();
14+
15+ int main () {
16+ int num1, num2;
17+
18+ printf (" Enter first number: " );
19+ scanf (" %d" , &num1);
20+
21+ printf (" \n " );
22+
23+ printf (" Enter second number: " );
24+ scanf (" %d" , &num2);
25+
26+ printf (" \n " );
27+
28+ // num1, num2 are actual parameters
29+ printf (" The sum is: " );
30+ printf (" %d" , sum (num1, num2));
31+
32+ g ();
33+
34+ return 0 ;
35+ }
36+
37+ // defining a function
38+ int sum (int a, int b) {
39+ // Formal Paramertes, a and b will be taking values
40+ // from actual parameters num1 and num2
41+ int c = a+b;
42+ return c;
43+ }
44+
45+ // void functions
46+ void g () {
47+ printf (" This is a greeting messge!" );
48+ }
You can’t perform that action at this time.
0 commit comments