-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.c
53 lines (51 loc) · 1.06 KB
/
example.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
#include<stdio.h>
//to find odd or even number
void odd_even(int x) {
if(x&1){
printf("It is odd\n");
}
else{
printf("It is even\n");
}
}
float result(float a ,float b){
float c=a+b;
printf("Sum =%f",c);
}
int Greatest_number(int x,int y,int z){
printf("\n");
if ((x>y)&&(x>z))
printf("A is greatest");
if((y>x)&&(y>z))
printf("B is greatest ");
if((z>x)&&(z>y))
printf("C is greatest");
}
int Sum_of_Numbers(int a){
int sum=0;
for(int i =1;i<=a;i++){
sum+=i;
}
printf("\nAnswer is :%d",sum);
}
int Largest_element() {
int a,largest;
int num[6]={2,3,4,5,8,7} ;
printf("Enter the value:\n");
scanf("%d",&a);
largest=num[0];
for(int i=1;i<a;i++){
if(num[i]>largest){
largest=num[i];
}
}
printf("The largest value ::%d",largest);
}
int main(){
odd_even(2);
result(2.45,5.48);
Sum_of_Numbers(3);
Greatest_number(10,3,4);
Largest_element();
return 0;
}