Вы находитесь на странице: 1из 3

Assignment #2

1. How many output pins are accessed via the DATA PORT of a PC PARALLEL PORT?
2. How many input pins are accessed via the STATUS PORT of a PC PARALLEL PORT?
3. How many input/output pins are accessed via the CONTROL PORT of a PC PARALLEL
PORT?
4. How many pins of the PC PARALLEL PORT are grounded?
5. It is a macro that reads a byte from the input port specified by portID.
6. It is a macro that writes the word given by value to the output port specified by portID.
7. It is sometimes called a CENTRONICS interface.
8. What does EPP mean?
9. It returns the character read from the keyboard.
10. The speed of the motor is _________ to the voltage and the _______ is proportional to
current.
11. It is a type of electric motor which is used when something has to be positioned very
precisely.
12. Make a C program that asks the user to enter his/her middle initial, age and GWA last
semester and then display the information on the monitor using printf statement.
13. Write a program that asks the user to enter an integer decimal number and display the
equivalent value in hexadecimal and octal formats.
14. Write a program that asks the user to enter an octal number then display the equivalent
value in hexadecimal and decimal formats.
15. Write a program that asks the user to enter a floating point number and then display the
number in exponential form.
ANSWERS:
1.) 8
2.) 5
3.) 4
4.) 8
5.) _inp
6.) _outp
7.) Parallel port
8.) Enhanced Parallel Port
9.) Return Key
10.) proportional, torque
11.) Stepper motor
12.)
#include<stdio.h>
#include<conio.h>

char MI;
int AGE;
float GWA;

void main()
{
clrscr();
printf(“Middle Initial : \n”);
scanf(“%c”,&MI);
printf(“\nAge : \n“);
scanf(“%i”,&AGE);
printf(“\nGeneral Weighted Average : \n”);
scanf(“%f”,&GWA);
clrscr();
printf(“Your Middle Initial is %c\n”,MI);
printf(“\nYour Age is %i\n”,AGE);
printf(“\nYour General Weighted Average is %f”,GWA);
getch();
}

13.)
#include<stdio.h>
#include<conio.h>

int D;

void main()
{
clrscr();
printf(“Enter an integer decimal number : ”);
scanf(“%d”,&D);
printf(“\nHexadecimal Equivalent : %x“,D);
printf(“\nOctal Equivalent : %o”,D);
getch();
}
14.) #include<stdio.h>
#include<conio.h>

int X;

void main()
{
clrscr();
printf(“Enter a hexadecimal number : ”);
scanf(“%x”,&X);
printf(“\nOctal Equivalent : %o“,O);
printf(“\nDecimal Equivalent : %d”,O);
getch();
}

15.)
#include<stdio.h>
#include<conio.h>

float E;

void main()
{
clrscr();
printf(“Enter number : ”);
scanf(“%f”,&E);
printf(“\nExponential Form : %e“,E);
getch();
}

Вам также может понравиться