CS Knowledge Opener - Logo
CS Knowledge
Opener
Facebook Youtube Telegram
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
CS Knowledge Opener - Logo
CS Knowledge
Opener
Facebook Youtube Telegram
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
12th CS English Medium

Practical Program Exercise 1 Calculate Factorial and Sum of Series for 12th Computer Science

Baskaran J
February 1, 2023 One Min Read
1.4K Views
0 Comments

Looping

  • we may need to execute a set of statements multiple times, called iteration or looping.

for loop

  • for loop is the most comfortable loop.
  • It is also an entry check loop.
  • The condition is
    checked in the beginning and the body of the loop(statements-block 1) is executed if it is only True otherwise the loop is not executed.

PY 1(a) – CALCULATE FACTORIAL

QUESTION:

Write a program to calculate the factorial of the given number using for loop.

AIM:

To calculate the factorial of the given number using for loop.

CODING:

num = int(input(“Enter the number:”))

if(num==0):

fact = 1

fact = 1

for i in range(1, num+1):

fact = fact*i

print(“Factorial of “, num,” is”, fact)

OUTPUT:

Enter a Number: 0

Factorial of 0 is 1

 

Enter a Number: 12

Factorial of 12 is 479001600

RESULT:

The Output was verified successfully

PY 1(b) – SUM OF SERIES

QUESTION:

Write a program to sum the series: 1/1 + 22/2 + 33/3 + ……. nn/n

AIM:

To calculate the sum of the series: 1/1 + 22/2 + 33/3 + ……. nn/n

CODING:

num = int(input(“Enter a value of n:”))

s=0.0

for i in range(1,num+1):

a=float(i**i)/i

s=s+a

print(“The sum of the series is”, s)

 

OUTPUT:

Enter a value of n: 4

The sum of the series is 76.0

RESULT:

The Output was verified successfully

Tags:

Practical

Share Article

Follow Me Written By

Baskaran J

Other Articles

Previous

What is python? How to install python? for 12th computer science

Next

Practical Program Exercise 1 Gross Salary for 11th Computer Science

Next
February 1, 2023

Practical Program Exercise 1 Gross Salary for 11th Computer Science

Previous
January 31, 2023

What is python? How to install python? for 12th computer science

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

fourteen + 1 =

Related Posts

12th CS Board Exam Answer Key Discussion 2024-2025

Baskaran J
March 14, 2025

12th Computer Science English medium Program Question 2024-2025

Baskaran J
February 23, 2025

12th Computer Science Practice One marks question 2024-2025

Baskaran J
February 3, 2025

12th Computer Science English medium Public Exam Important Important Question 2024-2025

Baskaran J
January 16, 2025

Subscribe to our newsletter and stay updated.

CS Knowledge Opener

CS Knowledge Opener focuses on 11th &12th Computer Science & Computer Applications English Medium & Tamil Medium. Programming Skills and also we are Publishing Study Materials Based on New syllabus introduced by TNSCERT. (TNBOARD).

Quick Links

  • Contact Us
  • About Us
  • Privacy Policy
  • Disclaimer
  • Terms and Conditions
Categories
11th CA English Medium 15
11th CA Tamil Medium 9
11th CS English Medium 21
11th CS Tamil Medium 12
12th CA English Medium 32
12th CA Tamil Medium 8
12th CS English Medium 36
12th CS Tamil Medium 12
Government Exams 36
Notifications 8
Other Subjects 13

Follow Us

Youtube
Facebook
Telegram
CS Knowledge Opener © 2020 - 2025. All Rights Reserved.