How can I solve this by using for loop

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

How can I solve this by using for loop

%^•
●
то
This program inserts 10 floating point values into an array using for loop, the start
value for the array must be read from the user, and the increment between each two
values is 1.20
1. Prints out the second, fourth, sixth, eighth and tenth members of the array using
pointers to access the members of the array.
2. then print and sum of the first, third, fifth, seventh, and ninth using pointers to
access the members of the array.
#include<stdio.h>
int main() {
float a [10];
float *p;
float sum=0;
float t;
printf("Enter Number to start with: ");
scanf("%f",&t);
for(int i=0; i<10; i++) {
a[i] = t;
t+=1.20; }
// print second, fourth, sixth, eighth and tenth members
// print the first, third, fifth, seventh, and ninth members
// print the sum of the first, third, fifth, seventh, and ninth
members
الخميس ٢٧ أكتوبر
+ :
2
11:1
Transcribed Image Text:%^• ● то This program inserts 10 floating point values into an array using for loop, the start value for the array must be read from the user, and the increment between each two values is 1.20 1. Prints out the second, fourth, sixth, eighth and tenth members of the array using pointers to access the members of the array. 2. then print and sum of the first, third, fifth, seventh, and ninth using pointers to access the members of the array. #include<stdio.h> int main() { float a [10]; float *p; float sum=0; float t; printf("Enter Number to start with: "); scanf("%f",&t); for(int i=0; i<10; i++) { a[i] = t; t+=1.20; } // print second, fourth, sixth, eighth and tenth members // print the first, third, fifth, seventh, and ninth members // print the sum of the first, third, fifth, seventh, and ninth members الخميس ٢٧ أكتوبر + : 2 11:1
%^•
Order
Array Value
index
The output must be in this format: (You can use any starting value)
то
Enter Number to start with: 5.00
This is number (2): 6.20
This is number (4): 8.60
This is number (6): 11.00
This is number (8): 13.40
This is number (10): 15.80
this is number (1): 5.00
this is number (3): 7.40
this is number (5): 9.80
this is number (7): 12.20
this is number (9): 14.60
Sum is 49.00
Pictorial Presentation:
first second third
5.00 6.20 7.40
0
1
2
fourth fifth
8.60 9.80
3
4
sixth seventh eighth ninth tenth
11.00 12.20 13.40 14.60 15.80
5
7
9
6
8
الخميس ٢٧ أكتوبر
+:
2
11:1
2
Transcribed Image Text:%^• Order Array Value index The output must be in this format: (You can use any starting value) то Enter Number to start with: 5.00 This is number (2): 6.20 This is number (4): 8.60 This is number (6): 11.00 This is number (8): 13.40 This is number (10): 15.80 this is number (1): 5.00 this is number (3): 7.40 this is number (5): 9.80 this is number (7): 12.20 this is number (9): 14.60 Sum is 49.00 Pictorial Presentation: first second third 5.00 6.20 7.40 0 1 2 fourth fifth 8.60 9.80 3 4 sixth seventh eighth ninth tenth 11.00 12.20 13.40 14.60 15.80 5 7 9 6 8 الخميس ٢٧ أكتوبر +: 2 11:1 2
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

How can solve this problem using for loop

%^•
Order
Array Value
index
The output must be in this format: (You can use any starting value)
то
Enter Number to start with: 5.00
This is number (2): 6.20
This is number (4): 8.60
This is number (6): 11.00
This is number (8): 13.40
This is number (10): 15.80
this is number (1): 5.00
this is number (3): 7.40
this is number (5): 9.80
this is number (7): 12.20
this is number (9): 14.60
Sum is 49.00
Pictorial Presentation:
first second third
5.00 6.20 7.40
0
1
2
fourth fifth
8.60 9.80
3
4
sixth seventh eighth ninth tenth
11.00 12.20 13.40 14.60 15.80
5
7
9
6
8
الخميس ٢٧ أكتوبر
+:
2
11:1
2
Transcribed Image Text:%^• Order Array Value index The output must be in this format: (You can use any starting value) то Enter Number to start with: 5.00 This is number (2): 6.20 This is number (4): 8.60 This is number (6): 11.00 This is number (8): 13.40 This is number (10): 15.80 this is number (1): 5.00 this is number (3): 7.40 this is number (5): 9.80 this is number (7): 12.20 this is number (9): 14.60 Sum is 49.00 Pictorial Presentation: first second third 5.00 6.20 7.40 0 1 2 fourth fifth 8.60 9.80 3 4 sixth seventh eighth ninth tenth 11.00 12.20 13.40 14.60 15.80 5 7 9 6 8 الخميس ٢٧ أكتوبر +: 2 11:1 2
%^•
●
то
This program inserts 10 floating point values into an array using for loop, the start
value for the array must be read from the user, and the increment between each two
values is 1.20
1. Prints out the second, fourth, sixth, eighth and tenth members of the array using
pointers to access the members of the array.
2. then print and sum of the first, third, fifth, seventh, and ninth using pointers to
access the members of the array.
#include<stdio.h>
int main() {
float a [10];
float *p;
float sum=0;
float t;
printf("Enter Number to start with: ");
scanf("%f",&t);
for(int i=0; i<10; i++) {
a[i] = t;
t+=1.20; }
// print second, fourth, sixth, eighth and tenth members
// print the first, third, fifth, seventh, and ninth members
// print the sum of the first, third, fifth, seventh, and ninth
members
الخميس ٢٧ أكتوبر
+ :
2
11:1
Transcribed Image Text:%^• ● то This program inserts 10 floating point values into an array using for loop, the start value for the array must be read from the user, and the increment between each two values is 1.20 1. Prints out the second, fourth, sixth, eighth and tenth members of the array using pointers to access the members of the array. 2. then print and sum of the first, third, fifth, seventh, and ninth using pointers to access the members of the array. #include<stdio.h> int main() { float a [10]; float *p; float sum=0; float t; printf("Enter Number to start with: "); scanf("%f",&t); for(int i=0; i<10; i++) { a[i] = t; t+=1.20; } // print second, fourth, sixth, eighth and tenth members // print the first, third, fifth, seventh, and ninth members // print the sum of the first, third, fifth, seventh, and ninth members الخميس ٢٧ أكتوبر + : 2 11:1
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
LUP Decomposition
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education