OUTPUT:
enter no of processes: 5
enter process1 name: aaa
enter process time: 4
enter process2 name: bbb
enter process time: 3
enter process3 name: ccc
enter process time: 2
enter process4 name: ddd
enter process time: 5
enter process5 name: eee
enter process time: 1
p_name P_time w_time
aaa 4 0
bbb 3 4
ccc 2 7
ddd 5 9
eee 1 14
total waiting time=34
avg waiting time=6.80
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 | #include<stdio.h> #include<conio.h> #include<process.h> void main() { char p[10][5]; int tot=0,wt[10],i,n; float avg=0; clrscr(); printf("enter no of processes:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("enter process%d name:\n",i+1); scanf("%s",&p[i]); printf("enter process time"); scanf("%d",&pt[i]); } wt[0]=0; for(i=1;i<n;i++) { wt[i]=wt[i-1]+et[i-1]; tot=tot+wt[i]; } avg=(float)tot/n; printf("p_name\t P_time\t w_time\n"); for(i=0;i<n;i++) printf("%s\t%d\t%d\n",p[i],et[i],wt[i]); printf("total waiting time=%d\n avg waiting time=%f",tot,avg); getch(); } |
OUTPUT:
enter no of processes: 5
enter process1 name: aaa
enter process time: 4
enter process2 name: bbb
enter process time: 3
enter process3 name: ccc
enter process time: 2
enter process4 name: ddd
enter process time: 5
enter process5 name: eee
enter process time: 1
p_name P_time w_time
aaa 4 0
bbb 3 4
ccc 2 7
ddd 5 9
eee 1 14
total waiting time=34
avg waiting time=6.80
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Resources #Terms of Use
Copyright©2012 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com
hi friends i dont know large programs pls give some examples to my mail its a humble request
hii… i want only algo for fcfs plzzz help …..
import java.lang.*;
import java.util.*;
class cgpa
{
public static void main(String args[])
{
int i;
float d,e,f;
float[] c=new float[50];
float[] b=new float[50];
float[] a=new float[50];
Scanner sc=new Scanner(System.in);
System.out.println(“Enter number of grade points obtained by the student in 1st semester”);
System.out.println(“Enter number of grade points obtained by the student in English and C”);
for(i=1;i<3;i++)
{
c[i]=sc.nextInt();
c[i]=(c[i]*3);
c[i]=c[i]+c[i-1];
}
System.out.println("Enter number of grade points obtained in Maths-1,Physics-1,Chemistry-1");
for(i=1;i<4;i++)
{
b[i]=sc.nextInt();
b[i]=(b[i]*4);
b[i]=b[i]+b[i-1];
}
System.out.println("Enter number of grade points obtained in C lab,Chemistry lab,Workshop");
for(i=1;i<4;i++)
{
a[i]=sc.nextInt();
a[i]=(a[i]*2);
a[i]=a[i]+a[i-1];
}
d=(a[3]+b[3]+c[2])/24;
System.out.println("SGPA Of the 1st semester is"+(float)d);
System.out.println("Enter number of grade points obtained by the student in 2nd semester");
System.out.println("Enter number of grade points obtained by the student in English,Maths-2,maths-3,physics-2,chemistry-2,c++");
for(i=1;i<7;i++)
{
a[i]=sc.nextInt();
a[i]=(a[i]*3);
a[i]=a[i]+a[i-1];
}
System.out.println("Enter number of grade points obtained by the student in Physics lab,c++ lab,Engg Graphics lab");
for(i=1;i<4;i++)
{
b[i]=sc.nextInt();
b[i]=(b[i]*2);
b[i]=b[i]+b[i-1];
}
e=(a[6]+b[3])/24;
System.out.println("SGPA Of the 2nd semester is"+(float)e);
System.out.println("CGPA is"+(float)(d+e)/2);
System.out.println("Enter number of grade points obtained by the student in 3rd semester");
System.out.println("Enter number of grade points obtained by the student in BE,DMS,PSQT,FDL");
for(i=1;i<5;i++)
{
a[i]=sc.nextInt();
a[i]=(a[i]*3);
a[i]=a[i]+a[i-1];
}
System.out.println("Enter number of grade points obtained by the student in Es and DS");
for(i=1;i<3;i++)
{
b[i]=sc.nextInt();
b[i]=(b[i]*4);
b[i]=b[i]+b[i-1];
}
System.out.println("Enter number of grade points obtained in DS lab,Electronics lab and English lab");
for(i=1;i<4;i++)
{
c[i]=sc.nextInt();
c[i]=(c[i]*2);
c[i]=c[i]+c[i-1];
}
f=(a[4]+b[2]+c[3]/26);
System.out.println("SGPA Of the 3rd semester is"+(float)f);
System.out.println("CGPA is"+(float)(d+e+f)/3);
}
}
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.image.*;
public class str extends JApplet implements ActionListener {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JApplet applet = new Ex6();
frame.getContentPane().add(applet);
applet.init();
applet.start();
frame.setSize(400,200);
frame.show();
}
JTextField text = new JTextField(“Artan Potera”);
JTextArea ta = new JTextArea(20, 80);
public void init() {
ta.setFont(new Font(“Monospaced”, Font.PLAIN, 20));
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
p.add(text, BorderLayout.CENTER);
JButton b = new JButton(“Print”);
b.addActionListener(this);
p.add(b, BorderLayout.EAST);
this.getContentPane().setLayout(new BorderLayout());
this.getContentPane().add(p, BorderLayout.NORTH);
this.getContentPane().add(ta, BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e) {
String s = text.getText();
if (s != null) {
BufferedImage bi = new BufferedImage(80,20,BufferedImage.TYPE_INT_BGR);
Graphics2D g2 = (Graphics2D)bi.getGraphics();
g2.setFont(new Font(“Serif”, Font.BOLD, 20));
g2.drawString(s, 0, 16);
Raster ras = bi.getData();
ta.setText(“”);
for (int row = 0; row < 20; row++) {
String line = "";
for (int col = 0; col 98) {
line += “*”;
} else {
line += ” “;
}
}
System.out.println(line);
ta.append(line+”\n”);
}
}
}
}
vegineti babuuuuuuuuuuu
kaamadana
hahahahaa………..
rey……vck peru tho evadu ra aa commentlu….??
arey errors vastunnay ra……
lyt thesko@raju
arey how to compile welcome program
cgpa program lo 3rd semester lo line 77 lo brackets arrays lo matrame pettu….. nd cgpa program naku bane execute ayindi ra….
welcome program minimum kuda raledu…..sum1 post it!
aasa dosa appadam vada….
can ne1 write the program of fcfs using pipes to stimulate fcfs???
Guyz… Can v make Program to run algorithm with premitive and non premitive.
can nybdy xplain d logic of above program?????????/
Can you help me with Last Come, First Served (LCFS) or Last In, First Out (LIFO)
C program codes? Please. Many Thanks!
Fcfs ka algo in c me chahiye plz btaona
wrong prog recompile it
teeri maaa ki
its good to understand dude
hgafgsdrwteyyjhwhsjs jjshhsgd…………….??????????????”"”"”"”"”"”