-
Notifications
You must be signed in to change notification settings - Fork 9
/
squares.c
38 lines (35 loc) · 912 Bytes
/
squares.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/
#include<stdio.h>
int main()
{
int num,num1;
int count=0;
printf("Enter a two digit odd number\n");
scanf("%d",&num);
num1=num;
while(num>0)
{
num=num/10;
count++;
}
if((num1%2) && (count==2))
{
printf("\nThe square of given number is: %d",num1*num1);
printf("\nThe cube of given number is: %d",num1*num1*num1);
}
else
{
printf("The number entered is not an two digit odd number\n");
}
return 0;
}
/* Author: Sandeepa Nadahalli */