forked from iedcbootcampcec/letshack-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux.c
40 lines (38 loc) · 697 Bytes
/
linux.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
//Implementation Of system Calls
#include <stdio.h>
#include <unistd.h>
void main()
{
int limit;
printf("Enter The Limit: ");
scanf("%d",&limit);
pid_t pid;
pid=fork();
if(pid==0)
{
printf("********\n");
printf("Child Process \n");
printf("Even No.s Upto Limit %d : \n", limit);
for(int i=0;i<=limit;i++)
{
if(i%2==0)
printf("%d",i);
}
printf("\n");
printf("Process ID of Child Process: %d \n", getpid());
}
else
{
printf("********\n");
printf("Parent Process \n");
printf("********\n");
printf("Odd No.s upto Limit %d : \n", limit);
for(int i=0;i<=limit; i++)
{
if(i%2!=0)
printf("%d",i);
}
printf("\n");
printf("Process ID OF Parent Process %d", getpid());
}
}