Write a program which uses lower 4 bits of P0 as input and c

Write a program which uses lower 4 bits of P0 as input, and calculates the square of the data available at P0.

Solution

#include <reg51.h>

void main(void)

{

unsigned char mynum[],mysquare[];

unsigned char z;

mynum[0]=P0.4;

mynum[1]=P0.5;

mynum[2]=P0.6;

mynum[3]=P0.7;

% squares of data

for (z=0;z<=3;z++)

mysquare[i]=mynum[i]*mynum[i];

}

Write a program which uses lower 4 bits of P0 as input, and calculates the square of the data available at P0.Solution#include <reg51.h> void main(void) {

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site