Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Loops (While, Do..While, For)
- Q1) Write a C program to print numbers from 0 to 100. (You are required to write 3 separate answers each using While, Do..While, For, looping structures).
- Q2) Write a C program to calculate and print the total of 10 marks and the average. If the average is less than 50 program should print “Fail!” otherwise “Pass!”
- Q3) Write a C program to calculate factorial of a user given number.
- Hint:
- • Select an appropriate looping structure.
- • Factorial of ‘0’ is ‘1’ (0! = 1)
- • Ex: factorial of number 5 is calculated as 5! = 5*4*3*2*1
- Q4) Write a C program to calculate the sum of all digits of a user given number.
- • If user input 123 your program should output 6. (calculated as 1+2+3)
- Q5) Write a C program to reverse the digits of a number using do-while statement.
- Q6) Write a C program to calculate nth power of a given integer. The user input base and exponent. (Do NOT use inbuilt functions, instead use a loop)
- Q7) Write a C program to print first 10 numbers of “Fibonacci Sequence”.
- Q8) Write a C program to check whether a given number is an Armstrong Number! (Refer to previous flowcharts)
- Q9) Write a C program to print all the ASCII values for letters A to Z.
- Q10) Write a program to print this pattern.
- *
- **
- ***
- ****
- *****
- Q11) Write a program to check whether a given number is prime or not.
- Q12) Write a C program to print all factors of a given integer.
- Q12) Write a C program to add all user inputs until user input ‘-1’. And then display the sum.
- Q13) Write a C program to read user inputs for an integer array (size = 10) and print the array.
- Q14) Re-Write the above code to count all the even numbers in above integer array and display the count.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement