Saturday, 10 December 2011

Write a program to print square of given value by user in c

#include
#include
main()
{
int num,sqr,i,max;
clrscr();
printf("Enter The Value;");
scanf("%d",&num);
max=num+10;
for(i=num;i {
sqr=num*num;
printf("\n\t%d SQUARE=%d",i,sqr);
num=num+1;
}
getch();
}

OUTPUT
Enter The Value: 5
5 SQUARE = 25
6 SQUARE = 36
7 SQUARE = 49
8 SQUARE = 64
9 SQUARE = 81
10 SQUARE = 100
11 SQUARE = 121
12 SQUARE = 144
13 SQUARE = 169
14 SQUARE = 196

No comments:

Post a Comment