Skip to content

Commit 0fea57a

Browse files
committed
added more codes
1 parent 511ee8f commit 0fea57a

File tree

9 files changed

+65
-0
lines changed

9 files changed

+65
-0
lines changed

Diff for: Strings/a.out

16.5 KB
Binary file not shown.

Diff for: Strings/string_length_using_for_loop.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//string length using for loop
2+
#include<stdio.h>
3+
int main()
4+
{
5+
char string[10],i;
6+
printf("enter string\n");
7+
scanf("%s",string);
8+
9+
for(i=0;string[i];i++);
10+
printf("length of string %s is %d\n",string,i);
11+
}

Diff for: coding_challenge/a.out

-16 Bytes
Binary file not shown.

Diff for: coding_challenge/exactly_three.c

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//wap to find the given no have exactly three divisors
2+
#include<stdio.h>
3+
int main()
4+
{
5+
int n,count=0;
6+
printf("enter n\n");
7+
scanf("%d",&n);
8+
9+
for(int i=1;i<=n;i++){
10+
if(n%i==0){
11+
count++;
12+
printf("%d ",i);
13+
}
14+
}
15+
if(count==3)
16+
printf("\n%d have exactly three divisors\n",n);
17+
else
18+
printf("\n%d have not exactly three divisors\n",n);
19+
}

Diff for: pointers/a.out

16.4 KB
Binary file not shown.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//little endian or big endian
2+
#include<stdio.h>
3+
int main()
4+
{
5+
int x=10;
6+
char *cp;
7+
cp=&x;
8+
9+
if((*cp)==10)
10+
printf("system follow little endian\n");
11+
else
12+
printf("system follow big endian\n");
13+
}

Diff for: pointers/working_of_pointer.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//working of pointers
2+
#include<stdio.h>
3+
int main()
4+
{
5+
int a=258,*ip;
6+
char *cp;
7+
cp=&a;
8+
ip=&a;
9+
printf("i:%d\n",*ip);
10+
printf("c:%d\n",*cp);
11+
}

Diff for: random_pgrms/a.out

-16 Bytes
Binary file not shown.

Diff for: random_pgrms/pointer_basics.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//pointer concept
2+
#include<stdio.h>
3+
int main()
4+
{
5+
int i=10;
6+
int *p;
7+
p=&i;
8+
printf("p:%u\n",p);
9+
printf("*p:%d\n",*p);
10+
printf("%d\n",sizeof(*p));
11+
}

0 commit comments

Comments
 (0)