j

Monday, 2 November 2015

Write a program that take 5 digit number from user and display square and cube of all digit



#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n,a,b,c,d;
printf("Enter 4-digit number:");
scanf(“%d”,&n);
b=n/1000;
n=n%1000;
c=n/100;
n=n%100;
d=n/10;
n=n%10;
printf("Digit\tSquare\tCube");
printf("  b\t  <<b*b\t b*b*b\n”);
printf("  c\t  <<c*c\t  c*c*c\n”);
printf("  d\t  d*d\t  d*d*d\n);
printf("  n\t  n*n\t  n*n*n\n);
getch();
}

Subscribe to this Blog via Email :