0% found this document useful (0 votes)
2K views16 pages

C.S Practical File Class-11

Uploaded by

Pratham Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
2K views16 pages

C.S Practical File Class-11

Uploaded by

Pratham Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 16
[Write a program to enter two numbers and perform all arithmetic operators''' nt (input (‘Enter a number')) nt (input ("Enter any second number')) print ("The sum of the two numbers is’, (a+b) print (*The difference of the two numbers is’, (a-b)) print (‘The product of the two numbers is", (a*b)) print ("The division of the two numbers is", (a/b)) print('// operation’, (a//b)) print('S operation", (a%b)) Enter a number23 Enter any second number3 The sum of the two numbers is 26 The difference of the two numbers is 20 The product of the two numbers is 69 The division of the two numbers is 7.666666666666667 // operation 7 % operation 2 '' write a program to enter radius of a circle and display area and circumference.''' a=int (input ("Enter the radius')) b=3.14 print('The area of the circle is', (a*a)*b) print ('The circumference of the circle is', (2*a*b)) Enter the radius49 The area of the circle is 7539.14 The circumference of the circle is 307.72 |''"Write a program to get the temperature in farenheit and display it in celsius.''' a=int (input (‘Enter temperature in farenheit')) print ("The temperature in celsius is", (5/9)*(a-32)) Enter temperature in farenheit95 The temperature in celsius is 35.0 |'"'write a program to enter height in inches and convert it into feets and inches.""" t (input ("Enter height in inches')) a print('The the height in feets and inches is', (a//b),'feet', (((a/b)-(a//b)) *12) «'inches'") Enter height in inches25 7 aoe The the height in feets and inches is 2 feet 1.0000000000000018 i |"""Write a program to enter two variables and swap the two variables.''' nt (input ('Enter first number')) nt (input ("Enter the second number')) print (a,b) Enter first number23 Enter the second number34 34 23 Write a program to enter Principal, interest and time and calculate S.1 and c.1''" nt (input ("Enter pricipal amount')) nt (input ("Enter interest')) ‘int (input ("Enter time')) print ('S.I is', ((P*R*T) /100)) print ('C.I is’, ((P*((1+(R/100))**T)))-P) Enter pricipal amount5000 Enter interest6 Enter time4 SL 2 1200.0 C.I is 1312.3848000000016 Write a program to enter a two digit number and reverse the numbers. nt (input ("Enter a two-digit number')) print ('The reversed number is", ((a%10)*10)+(a//10)) Enter a two-digit number23 The reversed number is 32 ‘Write a program to enter a number and check if the number is even or odd.''' nt (input ("Enter a number')) if a/2: 123 print('The number is even') els: print ("The number is odd’) Enter a number25 The number is odd ‘Write a program to enter a number if the number is positive or negative.''' int (input ("Enter a number')) if a>: print('It is a positive number") elif a<0: print('It is a negative number") else: print ('The number is neither positive nor negative’) Enter a number-33 It is a negative number ‘Write a program to enter three number and print the largest number.''! int (input ("Enter first number')) int (input ("Enter second number')) nt (input ("Enter third number')) if a>b and a>c: print ('The largest number is',a) elif b>a and boc: print ("The largest number is',b) elif c>a and c>b: print('The largest number is',c) Enter first number64 Enter second number33 |Enter third number32 The largest number is 64 |!" Write a program display a menu to calculate area or perimeter of circle. nt (input ("Enter the radius')) 14 nput ("Enter circumference or area') ‘circumference’: print ("The circumference of the circle is", (a*2*b)) if c=='area': print('The area of the circle is', ((a*a)*b)) Enter the radius49 Enter circumference or areaarea The area of the circle is 7539.14 ['"'Write a program to i as <(n) (ntl) (nt+2)>* n=int (input ("Enter the single-digit number')) print ('The three-digit number is", (n), (n+1), (n+2),sep= put a single digit(n) and print a three-digit number oe Enter the single-digit number2 The three-digit number is234 |'""Write a program to read three numbers in three variables and swap the first two variables with sum of first and second, second and third numbers respectivaly.''' a=int (input ('Enter first number')) nt (input ("Enter second number')) nt (input ("Enter third number')) print (a,b,c) Enter first number2 Enter second number3 Enter third numberS S Bod |'""Write a program to calculate BMI after entering value of weight in kg and height in m and print the nutritional status as per the table BMI<18.5 underweight BMI=18.5-24.9 Normal BMI=25-29.9 Overweight BMI>=30 Obese''" int (input ("Enter weight in kg’)) nt (input ("Enter height in m')) ‘a/ (b*b)) if c<18.5: print('The person is underweight") elif c>=18.5 or c<=24.9: print('The person has normal weight") elif c>=25 or c<=29.9: print ('The person is overweight") else: print('The person is obese!) Enter weight in kg56 Enter height in ml The person has normal weight "''Write a program to enter two numbers and perform the arithmetic operator provided by the user''! nt (input ("Enter a number')) nt (input ("Enter any second number") ) nput ("Enter symbol of which you want to perform the operation') EE gett ty print('The sum of the two numbers is', (at+b)) elif c E print ('The difference of the two numbers is', (a-b)) elie cee RY ¢ print ('The product of the two numbers is', (a*b)) elif ca="/': print('The division of the two numbers is', (a/b)) elas C7. print ('// operation', (a//b)) elif cos'%': print ('% operation", (a%b)) Enter a number32 Enter any second number12 Enter symbol of which you want to perform the operation/ The division of the two numbers is 2.6666666666666665, '' "Write a program to enter the units of electricity consumed and and create the bill by adding the rent amount.''' n=int (input ("Enter units consumed')) £=500 if n<=100: print ("The total bill amount is", (£+(n*10)) elif n>100 and n<=200: print (‘The total bill amount is", (f+(100*10)+(n-100)#15)) elif n>200 and n<=300: print ("The total bill amount is", (f+(100*10) +(100*15) + (n-200) *20)) else: print('The total bill amount is', (£+(100*10) +(100*15) +(100*20) + (n-300) *25 Enter units consumed300 The total bill amount is 5000 '""write a program to enter the amount spent and create a bill with appropriate discount Less than 10000 - 0% 10000-14999 - 10% 15000-19999 - 15% 20000-24999 - 20% «''! a=int (input ("Enter the total amount spent!)) if a<10000: print ("Your bill amount is', (a)) elif a>=10000 or ac=14999: print ("Your bill amount is', (a~((10/100)*a))) elif a>=15000 or a<=19999: print ('Your bill amount is', (a~((15/100)*a))) elif a>=20000 or a<=24999: print ("Your bill amount is', (a~((20/100)*a))) else: print ("Your bill amount is', (a~( (50/100) *a))) Enter the total amount spent25000 Your bill amount is 22500.0 |''" "Write a program to enter your name 10 times''' for i in range(1,11): print ('Pratham') Pratham Pratham Pratham Pratham Pratham Pratham Pratham Pratham Pratham Pratham |'''Write a program to print 10 natural numbers''' for i in range(1,11): print (i) PoODIDZOBWNP |"""Write a program to print first 10 even numbers''' for i in range(1,11): print (i*2) "' "Write a program to enter 10 numbers and check the number of even and odd numbers'"? b for i in range(1,11): n=int (input ("Enter a number')) print('No. of even numbers', a) print('No. of odd numbers', b) Enter ie is Enter Te is Enter Te 2s Enter It is Enter Tete Gigss Enter dats ass Enter te ais Enter re as Enter ie is Enter Te is your number44 an even number. your number53 an odd number. your number21 an odd number. your number22 an even number. your number46 an even number. your number78 an even number. your number75 an odd number. your number73 an odd number. your number26 an even number. your number23 an odd number. |!''Write a program to print reverse numbers from 10 to 1''! for i in range(10,0,-1): print (i) So RPNWAROADI®AOK |''"'Write a program to print the factorial of a number''' a=int (input ("Enter a number')) b=1 for i in range(a,0,-1): b=b*i print (b) Enter a number6 720 ‘Write a program to enter 3 angles and check whether it forms a triangle or nott!? nt (input ("Enter first angle')) nt (input ("Enter second angle')) nt (input ("Enter third angle')) if atb+c==180 print('It is a triangle') else: print ('It is not a triangle') Enter first angle60 Enter second angle60 Enter third angle60 It is) a triangle '''Write a program to enter 10 numbers and check the number of even and odd numbers''' a=0 b=0 for i in range(1,11): n=int (input ("Enter a number!) ) print ('No. even numbers', a) print ('No. odd numbers', b) Enter a number23 Enter a number12 Enter a number10 Enter a number41 Enter a number54 Enter a number55 Enter a number35 Enter a number36 Enter a number20 Enter a number29 No. of even numbers 5 No. of odd numbers 5 |'"'weite a program to enter a number and check whether it is prime or not'' a bea n=int (input ("Enter a number’) ) for i in range(2, ((n//2)+1)): print('It is a prime number' else: print ("It is not a prime number") Enter a number23 It is a prime number : Short Shirts 0-1000 + 5B 1001-2000 5% 10% 2001-3000 10% 15% >3000 15% 20% a=int (input ("enter price')) b=input('enter type of cloth') if a>=0 and a<=1000: i shorts': shirts': a-(a* (5/100) )) pants": c=(a-(a* (10/100) )) elif a>=1001 and a<=2000: shirts': c=(a-(a*(10/100))) elif b=="pants': c=(a-(a* (20/100) )) 001 and a<=3000: ‘shorts': Pants 10% 20% 30% 40% ''! c=(a-(a* (10/100) )) elif b=='shirts': c=(a-(a* (15/100))) elif b=='pants': c=(a- (a* (30/100) )) c=(a-(a* (15/100) )) elif b=='shirts': c=(a-(a* (20/100) )) elif b=='pants': c=(a-(a* (40/100) )) print ('Total bill',c) enter price3500 enter type of clothshorts Total bill 2975.0 |'""Write a program to calculate the total wages of employees according to the following data Age Sex Wage/Day Less than 30 M 500 F 550 30-40 M 800 F 850 40-50 M 1000 F 1100 If the criteria is not satisfied, then display please enter correct age and sex''' nt (input ("Enter Age')) b=input (‘Enter sex as M or F') if a<30: if b=='M! print ("Daily wage is',500) elif sg 3 print ("Daily wage is',550) elpe: print (‘Enter valid sex') elif a>=30 and a<40: a M’ print ("Daily wage is',800) elif b=='F': print ("Daily wage is',850) else: print (‘Enter valid sex') elif a>=40 and a<50: if b=='M" print (‘Daily wage is", 1000) elif b=='F': print ("Daily wage is", 1100) else: print ("Enter valid sex') else: print('Please enter correct age and sex') Enter Age35 Enter sex as M or FF Daily wage is 850 |" Write a program to print 10 natural numbers using while loop''’ while i<11: print (i) i=i+l ali A 5 4 S 6 rh 8 zy 10 '"'Write a program to enter starting value, ending value and sum of even numbers!!! int (input ("Enter starting value')) nt (input ("Enter end value')) print (s) Enter starting valuel Enter end valuel0 30 |''"Write a program to enter a number and print its reverse''' nt (input ('Enter number')) while n>0: r=n%10 s=s*10+r n=n//10 print (s) Enter number25 52 |!" Write a program to enter a number and check if it is palindrome''' nt (input ("Enter number')) n>0: %10 *10+r 7710 if s= print ('The number is a palindrome') else: print('The number is not a palindrome’) Enter number393 The number is a palindrome

You might also like