Easy Python programs

Print the ASCII value of Characters charr =(input("Enter a charcater")) print("The ASCII value of '" + charr + "' is", ord(charr)) Find the roots of quadratic equation import cmath a = int(input("Enter the value of a ")) b = int(input("Enter the value of b ")) c = int(input("Enter the value of c ")) # calculating... Continue Reading →

Area and Circumference of circle in python

#area and circumference of circle rad=float(input("Enter the radius of the circle ")) area= 3.14*rad*rad print("Area of the circle of given radius is = ", area) circum= 2*3.14*rad print("Circumference of the circle of given radius is = ", circum)

To check for Armstrong number in C

Armstrong number is a number which is equal to the sum of cubes of its digits. e.g. 0, 1, 153 etc are the Armstrong numbers. Demonstration: 153=(1*1*1)+(5*5*5)+(3*3*3) cube of 1=1 cube of 5=125 cube of 3=27 1+125+27=153 #include<stdio.h> int main() { int n,q,sum=0,temp; printf("Enter a number="); scanf("%d",&n); temp=n; while(n>0) { q=n%10; sum=sum+(q*q*q); n=n/10; } if(temp==sum) printf("The given... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started