-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrays.c
67 lines (56 loc) · 795 Bytes
/
Arrays.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
62
63
64
65
66
67
//finding average
#include<stdio.h>
main()
{
int sum=0;
int avg=0;
int x=0;
int max;
printf("Enter max:");
scanf("%d",&max);
int num[max];
for(x=0;x<max;x++)
{
printf("ENTER a num:",(x+1));
scanf("%d",&num[x]);
}
for(x=0;x<max;x++)
{
sum=sum+num[x];
}
avg=sum/10;
printf("%d is the average.",avg);
}
//reversing string
#include<stdio.h>
main()
{
int begin=0;
int count=0;
int end=0;
char s[100];
char r[100];
printf("Plz enter a string:");
gets(s);
while(s[count]!='\0')
count++;
end=count-1;
for(begin=0;begin<count;begin++)
{
r[begin]=s[end];
end--;
}
r[begin]='\0';
printf("%s\n",r);
}
//char value
#include<stdio.h>
main()
{
int c=0,n=126;
while(c<=n)
{
printf("%d : %c\n",c,c);
c++;
}
}