-
Notifications
You must be signed in to change notification settings - Fork 0
/
19-02-2024.txt
79 lines (67 loc) · 1.76 KB
/
19-02-2024.txt
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
71
72
73
74
75
76
77
78
79
#include <stdio.h>
void main(){
int Total;
printf("Enter amount :");
scanf("%d",&Total);
int coins = Total / 5; // 15 / 5 , 3
//printf("Rs.5 coins needed = %d", coins);
int remainingAmount = Total % 5; // 0
if(remainingAmount == 1 || remainingAmount == 2){ // or 2
coins += 1;
printf("Rs.1 coins needed = %d", coins);
}
else if(remainingAmount != 0){
coins += 2;
}
printf("%d",coins);
return;
}
#include<stdio.h>
int main(){
int arr[2][3];
arr[0][0] = 10;
arr[0][1] = 20;
arr[0][2] = 30;
arr[1][0] = 100;
arr[1][1] = 200;
arr[1][2] = 300;
int totalRow = 2;
int totalCol = 3;
for(int curCol = 0; curCol < totalCol; curCol++){ // help us to travel on cols
for(int curRow = 0; curRow < totalRow; curRow++){ // help us to travel on rows
printf("%d ", arr[curRow][curCol]);
//printf("%d ", arr[curCol][curRow]);
}
printf("\n");
}
return 0;
}
#include<stdio.h>
int main(){
int arr[2][3];
arr[0][0] = 10;
arr[0][1] = 20;
arr[0][2] = 30;
arr[1][0] = 100;
arr[1][1] = 200;
arr[1][2] = 300;
int totalRow = 2;
int totalCol = 3;
for(int curRow = 0; curRow < totalRow; curRow++){ // help us to travel on rows
for(int curCol = 0; curCol < totalCol; curCol++){ // help us to travel on cols
printf("%d ", arr[curRow][curCol]);
[0][0] , [0][1] , [0][2]
[1][0], [1][1]........
}
printf("\n");
}
return 0;
}
#include<stdio.h>
int main(){
int arr[10];
for(int i = 0; i < 10; i++){
printf("%d ", arr[i]);
}
return 0;
}