Please answer # 3, I am using Codelite . Thanks Write a program to generate and
ID: 3792214 • Letter: P
Question
Please answer # 3, I am using Codelite . Thanks
Write a program to generate and display a table of n and n^2, for integer values of n ranging from 1 to 10. Include appropriate column headings. Make sure the table and headings are formatted into two well-aligned columns. Write a program that uses two for loops. The first for loop prints the odd numbers from 1 to 13. The second for loop prints the even numbers from 2 to 16. Write a program that asks the user to enter four digits (separated by spaces) and then prints those digits in English. For example Enter three digits: 1 2 3 4 You entered digits: one two three four Your program should use a switch structure inside a for loop. The factorial of a positive integer n is the product of all integers from 1 to n. For example: 6! = 1 middot 2 middot 3 middot 4 middot 5 middot 6 Write a program that uses nested for loops to generate a table of the first 10 positive integers and their factorials. Include appropriate column headings. Make sure the table and headings are formatted into two well-aligned columns.Explanation / Answer
#include<stdio.h>
int main()
{
int arr[4];
printf(" enter 4 digits : ");
for(int i=0;i<4;i++){
scanf("%d",&arr[i]);
}
for(int i=0;i<4;i++){
switch(arr[i]){
case 1:
printf("one ");
break;
case 2:
printf("TWO ");
break;
case 3:
printf("three ");
break;
case 4:
printf("four ");
break;
case 5:
printf("five ");
break;
case 6:
printf("six ");
break;
case 7:
printf("seven ");
break;
case 8:
printf("eight ");
break;
case 9:
printf("nine ");
break;
default:
printf(" ");
break;
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.