Pages

Sunday, 20 May 2012

program to print square of given value by user


68./*Write a program to print square of given value by user.*/

#include<stdio.h>
#include<conio.h>
main()
{
            int num,sqr,i,max;
            clrscr();
            printf("Enter The Value;");
            scanf("%d",&num);
            max=num+10;
            for(i=num;i<max;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