-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7_Functions.c
61 lines (45 loc) · 1.06 KB
/
7_Functions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stdio.h>
/*Functions: block of code that performs particular task....
--> It can be used multiple times
--> increase code reusability
a.Function can only return one value at a time
b.Changes to parameters in function don't change the values in calling function*/
// Function Prototype/Declaration
/*void printHello();
//Function Definition
void printHello(){
printf("Hello");
}*/
//Sum of two numbers
int sum(int a, int b);
//Print table
void printTable(int n);
int main()
{
/*
//Sum of two numbers
int a, b;
printf("Enter first number: ");
scanf("%d", &a);
printf("Enter second number: ");
scanf("%d", &b);
int s = sum(a,b);
printf("Sum is: %d",s);*/
int n;
printf("Enter number: ");
scanf("%d",&n);
printf("Multiplication Table: ");
printTable(n);//argument/actual parameter
return 0;
// printHello();//Function call
}
int sum(int a, int b)
{
return a + b;
}
void printTable(int n)//parameter/formal paramter
{
for(int i=1;i<=10;i++){
printf("\n%d",i*n);
}
}