Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

Notes On Square And Cube

Loading...

Published in: C / C++
365 Views

The note will describe students about the C program

Fatima J / Hyderabad

11 years of teaching experience

Qualification: M.Sc (vbs purvanchal university - 2017)

Teaches: Basic Computer, MS Office, School Level Computer, Computer Science, Mathematics, Physics, Statistics, Science, B.Sc Tuition, B.Tech Tuition

Contact this Tutor
  1. Q. Write a C program to check the number entered by the use is even or odd. If it is even find its square and if it is odd find its cube. PROGRAM . #include #include #include int main() int num,sqr,cub; printf("Enter the number to check even or odd : \n"); scanf("%d",&num); if(num%2==0) printf("The number is Even\n"); sqr=num*num; printf("The square of the number %d is %d",num,sqr); else printf("The number is Odd\n"); cub=num*num*num; printf("The cube of the number %d is %d",num,cub); getch(); return O;
  2. OUTPUT i Enter the number to check even or odd 8 The number is Even The square of the number 8 is 64 Enter the number to check even or odd 11 The number is Odd The cube of the number 11 is 1331