-
Notifications
You must be signed in to change notification settings - Fork 0
/
LearningForLoop.c
58 lines (46 loc) · 1004 Bytes
/
LearningForLoop.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
// Name Ankesh Sharma
// Date 03-01-2024
// Language C
#include <stdio.h>
#include <conio.h>
// int reversearray();
int getscanfunction();
// int functionforloop();
int main(){
printf("Yes i am working");
// functionforloop();
// reversearray();
getscanfunction();
}
int arr[] = {1, 2, 3, 4, 5};
// Sumof an array
int functionforloop(){
int size = sizeof(arr)/sizeof(arr[0]);
// printf("size %d",size);
int bag = 0;
for(int i=0;i<size;i++){
bag+=arr[i];
}
printf("\nBag value is %d",bag);
}
// Reverse of an array
// int reversearray(){
// char bag[];
// int size = sizeof(arr)/sizeof(arr[0]);
// for(int i=size-1;i>=0;i--){
// bag+=arr[i];
// printf("%s%d\n"," ",arr[i]);
// }
// }
int getscanfunction(){
int a;
char b[100];
int arr[121];
scanf("\n%d",&a);
scanf("\n%s",&b);
scanf("%d",arr);
printf("The number is%d",a);
printf("\nThe value is %s",b);
printf("\n",arr);
getch();
}