Monday, April 11, 2016

Program that will take a integer as input and display its square as output

Q.Write a program that will take a integer as input and display its square as output.
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,x;
printf(“enter the integer for a=”);
scanf(“%d”,&a);
x=a*a;
printf(“\nThe square of a is=%d,x);
getch();
}
Output:
enter the integer for a=2

The square of a is=4

No comments:

Post a Comment