-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrays.c
More file actions
70 lines (66 loc) · 1.43 KB
/
Arrays.c
File metadata and controls
70 lines (66 loc) · 1.43 KB
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
62
63
64
65
66
67
68
69
70
/*#include<stdio.h>
int main(){
int marks1 = 97;
int marks2 = 98;
int marks3 = 100;
int marks[3] = {97,98,100};
printf("marks1= %d, marks2 = %d, marks3 =%d", marks[0],marks[1],marks[2]);
return 0;
}*/
/*
#include<stdio.h>
#include<stdlib.h>
int main(){
int row,col,i,j,a[10][10],zeroCount = 0,NonZeroCount=0;
printf("Enter row\n");
scanf("%d",&row);
printf("Enter Column \n");
scanf("%d",&col);
printf("Enter element of Matrix1\n");
for(i=0;i<row;i++){
for(j=0;j<col;j++){
scanf("%d",&a[i][j]);
}
}
printf("element are \n");
for(i=0;i<row;i++){
for (j=0;j<col;j++){
printf("%d\t",a[i][j]);
}
printf("\n");
}
//checking square of matrix
for(i=0;i<row;i++){
for(j=0;j<col;j++){
if(a[i][j]==0){
zeroCount++;
}
else{
NonZeroCount++;
}
}
}
if (zeroCount > NonZeroCount){
printf("Matrix is a square matrix \n");
}
else{
printf("Matrix is not square matrix\n");
}
}*/
#include<stdio.h>
int main(){
int n;
printf("Enter number \n");
scanf("%d",&n);
if (n%2==0){
int fact = 1;
int num;
for (int i=1;i<=n;i++){
num = fact*i;
}
printf("The factorial is %d",num);
}else{
printf("The number is odd");
}
return 0;
}