Skip to content

C-programming-2025/assignment-2-Sujal1323

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Review Assignment Due Date

Assignment 1: C Programming Basics

Instructions

  1. Write code in the corresponding src/ file for each programming task.
  2. Do not change file names — tests depend on them.
  3. Commit and push your changes to GitHub.

Questions

Q1. Write a C program that takes an integer input from the user and determines if it is positive, negative, or zero.

Q2. Write a C program that prompts the user for their age and determines if they are eligible to vote (consider the legal voting age in your country).

Q3. Write a C program that calculates the absolute value of a given number without using the built-in absolute value function.

Q4. Write a C program that prints all even numbers between 1 and 100 using a for loop.

Q5. Write a C program that prompts the user for a positive integer and calculates the factorial of that number using a while loop.

Q6. Write a C program that prompts the user for a number and prints its multiplication table up to 10 using a do-while loop.

Q7. Write a C program that prints a pattern of asterisks.

    *
    **
    ***
    ****
    *****
    ****
    ***
    **
    *

Q8. Write a C program that prints a pattern of asterisks.

    *
    **
    ***
    ****
    *****

Q9. Write a C program that prints a pattern of asterisks.

    *****
    ****
    ***
    **
    *

Q10. Write a C program that prints a pattern of asterisks.

      *
     ***
    *****

Q11. Write a C program that prints a pattern of asterisks.

    *****
     ***
      *

Q12. Write a C program that prints all numbers from 1 to 100 using a for loop.

Q13. Write a C program that calculates the sum of all even numbers from 1 to 50 using a while loop.

Q14. Write a C program that prompts the user for a positive integer and prints all the factors of that number using a for loop.

Q15. Write a C program that prompts the user for a positive integer and checks if it is a prime number using a while loop.

Q16. Write a C program that calculates the factorial of a given number using a do-while loop.

Q17. Write a C program that prompts the user for a positive integer and prints a countdown from that number to 1 using a for loop.

Q18. Write a C program that prompts the user for a positive integer and prints the multiplication table for that number up to 10 using a while loop.

Q19. Write a C program that prompts the user for a positive integer and prints a pattern of asterisks (*) in a square shape using nested loops.

Example: User’s Input = 2, then pattern to print will be:

    * *
    * *

Q20. Write a C program that prompts the user for a number between 1 and 7 and prints the corresponding day of the week using a switch-case statement.


Deadline: 23:59, Saturday, 6th Sep, 2025

About

c-programming-2025-classroom-assignment-2-assignment-2-conditional-loop-1 created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 59.7%
  • C 40.3%