C program to send values 00 to FF to port P1 (8051)

//send values 00 to FF to port P1 in c using Kiel for 8051 microcontroller
#include <reg51.h>
void main(void)
{
unsigned char c;
for (c=0;c<=255;c++)
P1=c;
}

C program to print square and square root

// Printing square and square root using c program
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i=0,sqr;
float sq;
clrscr();
printf("Value   Square Root   Square");
while(i<=100)
{
printf("\n");
sq=sqrt(i);
sqr=i*i;
printf("%d\t%f\t%d",i,sq,sqr);
i=i+10;
}
getch();
}

Output

c program square root