/**** Program to Find Sum and Average of Three Real Numbers ****/
#include <stdio.h>
main()
{
float a, b, c, sum, avg;
printf("\nEnter value of three numbers: ");
scanf("%f %f %f", &a, &b, &c);
sum = a + b + c;
avg = sum / 3;
printf("\nSum = %.2f", sum);
printf("\nAverage = %.2f", avg);
getch();
}
Simple program to show how children get
out of control if not monitored by the parent.
#include <stdio.h>
main (int argc, char *argv[])
{ int pid ;
char *args[2]
;
printf("Ready
to FORK\n") ;
pid
= fork() ;
if (pid
==0)
{ printf("I
AM THE CHILD!!\n") ;
args[0]
= "./a.out" ;
args[1]
= NULL ;
execv("./a.out", args) ;
printf("OPPSSSS\n")
;
}
else
printf("I
AM THE PARENT!!!\n") ;
//wait(NULL) ;
}
No comments:
Post a Comment