Skip to main content

Posts

Showing posts from May 4, 2021

How to Calculating the area of circle using Python

  How to Calculating the area of a circle using Python:- The area of the circle is the number of square units inside the circle, can be calculated using the radius and diameter. The formula for evaluating the area of a circle is Area of circle using radius=     Pi*r*r     ( r is the radius of the circle) Area of the circle using diameter=    1/4*Pi*d*d   ( d is the diameter of the circle) Pi is a Greek letter and the value of Pi is equal to 3.14159265359. In the program, we will be initiating Pi as a global variable or we can simply import from the math module present in python. The syntax for importing pi from math module:   from import math. ALGORITHMS:- 1 .Input radius/diameter.     2 . Calculate the area of a circle using the formula.              area= pi*r*r(if radius is given as input).              area=(pi*d*d)/4 (if diameter is given as input). 3 . Print area. CODE: - radius=  int ( input ( "Enter radius of the circle: \n " )) area= 3.14 *radius** 2 print ( "Ar

How to Find whether a given number is Positive or Negative in python

  How to Find whether a given number is Positive or Negative in python:-         In this Python Program, We will be discussing how to find a user-entered number that is positive or negative. We will check by using an if-else block and compare the given number with zero. If the user entered number is greater than zero then the number is positive. Else, the number is negative. ALGORITHMS:- Step 1 . Start. Step 2 . Insert the number. Step 3 . If the number is greater than zero, then print, “The number is Positive”. Step 4 . Else print, “You entered Negative”. Step 5 . Stop. CODE: -                                                                                                        num =  int ( input ( "Insert a number:" )) if  num >  0 :      print ( "The number is Positive" ) else :      print ( "The number is Negative" ) OUTPUT: -   FOLLOW AND SUBSCRIBE TO THIS WEBPAGE FOR MORE NEW PROGRAMS AND CODING SOLUTIONS. πŸ’¬πŸ’¬πŸ’¬πŸ’¬πŸ’—πŸ’—πŸ’—πŸ’—

How to Check a given number is Even or Odd ​in python

   How to Check a given number is Even or Odd in python​:-   In this Python program, we will be finding whether a number is even or odd. Even numbers are those positive natural numbers that are evenly divisible by 2 and Odd number is just the opposite, which is not evenly divisible by 2. If a number is even then it should return a remainder is 0 when the number is divided by 2 and if it is not equal to 0, then it is an Odd Number. ALGORITHMS:- Step 1 . Start Step 2 . Insert a number. Step 3 . If the given number is divisible by 2, it prints,” Given number is even”. Step 4 . If the given number is not divisible by 2, it prints,” Given number is odd”. Step 5 . Stop CODE: - num =  int ( input ( "Enter a Number:" )) if  num %  2  ==  0 :      print ( "Given number is Even" ) else :      print ( "Given number is Odd" ) OUTPUT:- FOLLOW AND SUBSCRIBE TO THIS WEBPAGE FOR MORE NEW PROGRAMS AND CODING SOLUTIONS. πŸ’¬πŸ’¬πŸ’¬πŸ’¬πŸ’—πŸ’—πŸ’—πŸ’—