Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help fixing my code so that it looks like the output example in the instructions using for loops in C. Especially where it

I need help fixing my code so that it looks like the output example in the instructions using for loops in C. Especially where it prints the odd integers. image text in transcribedimage text in transcribedimage text in transcribed

Must look exactly like this example

usermimir: -/cpsc1010_s21/chapterproject_42 > gcc -Wall C4.2.c user@mimir: -/cpsc1010 s21/chapterproject_42 > ./a.out Enter two integers. First number must be less than the second number you enter Enter 2 integers numbers: 10 20 Sum of the squares of odd integers between 10 and 20 = 0 odd integers between 10 and 20 are: 17 7 #include 8 int main() 9-{ 10 int firstNum; 11 int secondNum; 12 int sum=; 13 int i; 14 15 printf("Enter two integers. "); 16 printf("First number must be less than "); printf("the second number you enter "); 18 printf("Enter 2 integers numbers: "); 19 scanf("%d %d",&firstNum , &secondNum); 20 21 for(i=firstNum; i>=secondNum; i++) 22 { 23 if(1%2==1) 24 - { 25 sum-=1*i; 26 } 27 ] 28 printf(" Sum of the squares of odd integers between %d and %d = %d ", firstNum, secondNum, sum); 29 printf("Odd integers between %d and %d are: ", firstNum , secondNum); 30 31 for(i=firstNum;i>=secondNum; i--) 32 { 33 if(i%2!=0)//CHECKING FOR ODD NUMBER 34 { 35 printf("%d", 1); 36 } 37 if(i%2==0)//CHECKING FOR EVEN NUMBER 38 - 39 sum+=i; 40 } 41 ] 42 printf(" Sum of even integers between %d and %d = %d " ,firstNum , secondNum, sum); 43 printf("Number Square of Number "); for(i=firstNum;i 42 printf(" Sum of even integers between %d and %d = %d " ,firstNum, secondNum, sum); printf("Number Square of Number "); for(i=firstNum;i=97; i--) printf("%c ",1); printf(" "); Create program that uses for loops to perform the same steps as C4.1 (well, almost the same): Prompt the user to input two integers: firstNum and secondNum (firstNum must be less than secondNum) Output the sum of the square of the odd integers between firstNum and secondNum Output all odd integers between firstNum and secondNum, in descending order Output the sum of all even integers between firstNum and secondNum Output the integers and their squares between firstNum and secondNum, in ascending order Output all the lowercase letters in descending order (be sure to use a for loop All ranges include the end points (firstNum and secondNum). For example: Enter two integers. First number must be less than the second number you enter Enter 2 integers numbers: 10 20 Sum of the squares of odd integers between 10 and 20 = 1165 Odd integers between 10 and 20 are: 19 17 15 13 11 Sum of even integers between 10 and 20 = 90 Number Square of Number 10 100 11 121 12 144 13 169 14 196 15 225 16 256 17 289 18 324 19 361 20 400 Lower case letters are: z y xw vu tsr a pon ml kj i hgfedcba

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

Students also viewed these Databases questions

Question

Calculate the lifetime value (LTV) of a loyal customer.

Answered: 1 week ago

Question

Use service tiering to manage the customer base and build loyalty.

Answered: 1 week ago