This program shows how to create process and display Process ID (pid) of Both Parent and Child processes. The process is created using the fork system call in UNIX (Linux) operating systems.
#include<stdio.h>
#include<dirent.h>
main(int argc,char **argv)
{
Information about resetting and configuring Mobile phones (Java, Android, Symbian etc), educational articles especially for programming in C, C++ and Java and more about Computers and operating systems
Showing posts with label display. Show all posts
Showing posts with label display. Show all posts
How to Create process and display Process ID (pid) of Both Parent and Child
Labels:
$ccpp
,
c program
,
code
,
compiled
,
create
,
display
,
fork
,
getpid
,
lab
,
Linux
,
operating Systems
,
OS
,
Oslab
,
process
,
process id
,
programming
,
source code
,
system call
,
UNIX
C Program to Show Process ID in Linux
This program is to show the process id (pid) in UNIX or Linx
The system call getpid() returns the process id of current process.
#include<stdio.h>
int main()
{
printf("\n Parent Process ID %d",getppid());
}
The system call getpid() returns the process id of current process.
#include<stdio.h>
int main()
{
printf("\n Parent Process ID %d",getppid());
}
C Program to Display SCAN and ASCII Codes of Keys on Keyboard Using 8086 Interrupt
Output (ASCII and SCAN code) when a is pressed |
How to Display Mathematical Symblos, Greek Letters etc in HTML
When i was writing a post, i found it difficult to display some mathematical symbols in the post. At last, i solved it and found that there are easy to remember mnemonics for most of the symbols we come across. Sometimes you can get them only from the 'charmap' (enter charmap in 'Run' in your windows OS). There are escape sequences in HTML which will help you to include mathematical symbols and other Greek letters which are often used as variables or notation for some processes. To display these symbols in a webpage, simple mnemonics or corresponding code can be used. These informations are directly available in HTML4.0 website.
How To Make a Text Subscript or Superscript Using HTML Code
To make a text superscript or subscript in a webpage using HTML language, there are two tags provided in the language.
Superscript
To make a text or some characters superscript, the HTML tag <sup> is used. For example, suppose we have to display 2n+1. To display it, we have to use the following code:
2<sup>n+1</sup>
We have to enclose the characters to be made superscript in <sup> and </sup>
Superscript
To make a text or some characters superscript, the HTML tag <sup> is used. For example, suppose we have to display 2n+1. To display it, we have to use the following code:
2<sup>n+1</sup>
We have to enclose the characters to be made superscript in <sup> and </sup>
C and C++ Program to Display Armstrong Numbers upto 1000
This post about C and C++ programs to display all Armstrong numbers less than 1000. But before all, I should tell what an Armstrong number is. An Armstrong number is a number that is the sum of its own digits each raised to the power of the number of digits. Consider an example. 153 is an Armstrong number. Since it is a 3 digit number, to check whether it is an Armstrong number or not, we should add the 3rd power of each digit. So, in the program, we should have a code to determine number digits in number, then add the nth powers (where n is the number of digits) of each digit in the number and check whether both the sum and original number are the same.
C Program:
#include<stdio.h> #include<math.h> void main() { int n,sum,r,digits; for(n=1;n<=1000;n++) { digits=0; r=n; sum=0; while(r!=0) //Counting Digits { digits++; r/=10; } r=n; while(r!=0) /*Adding Digits Raised To a Power That Is Equal To Number of Digits */ { sum+=pow((r%10),digits); r=r/10; } if(sum==n) { printf("%5d",sum); } } }
C++ Program:
C and C++ Program to Display Pascal's Triangle
This post gives C and C++ programs to display given number of rows of pascal's triangle. Thenuser can enter the number of rows of pascal triangle to be displayed.
C Program:
C Program:
#include<stdio.h> #include<conio.h> long factorial(int); main() { int i, n, c; printf("Enter the number of rows you wish to see in pascal triangle\n"); scanf("%d", &n); for (i = 0; i < n; i++) { for (c = 0; c <= (n - i - 2); c++) printf(" "); for (c = 0; c <= i; c++) printf("%ld ", factorial(i) / (factorial(c) * factorial(i - c))); printf("\n"); } getch(); }
Labels:
$ccpp
,
c language
,
c plus plus
,
C programming
,
code
,
coding
,
cpp
,
display
,
pascal's
,
pascals
,
source code
,
triangle
Subscribe to:
Posts
(
Atom
)