The code must be written in code composer studio to interface with a msp430. 6.8
ID: 3902494 • Letter: T
Question
The code must be written in code composer studio to interface with a msp430.
6.8 Problems 6.1 Write a program in the C language such that: a. It contains a function which calculates the third power of a given integer. b. Your p rogram should calculate the third powers of numbers between 1 and 10 using your function. The results should be saved in an array c. Take the overflow possibility into account. Write a C pr provides the first two entries of the series. The rest will be calculated by the p result will be saved in an array. ogram to calculate the first 10 elements of the Fibonacci series. The user only rogram. The 6.2Explanation / Answer
#6.1
#include <stdio.h>
int main ()
{
int number[10];
for (int i=1; i<11; ++i)
{
number[i-1] = i*i*i;
}
for (int i=0; i<10; ++i)
{
printf ("%d ",number[i]);
}
}
#6.1
#include <stdio.h>
int main ()
{
int number[10];
int a,b;
printf ("Enter the value of a ");
scanf ("%d",&a);
printf ("Enter the value of b ");
scanf ("%d",&b);
number[0]=a;
number[1]=b;
for (int i=2; i<10; ++i)
{
number[i] = a+b;
int tmp=b;
b=a+b;
a=tmp;
}
for (int i=0; i<10; ++i)
{
printf ("%d ",number[i]);
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.