Write compound operators for the following equations: a. intFieldGoal = intField
ID: 3863340 • Letter: W
Question
Write compound operators for the following equations: a. intFieldGoal = intFieldGoal + 3 b. dblCube = dblCube^3 c. strDog = strDog & "Treat" 3. Write For...Next loops that calculate the sum of the following ranges and assign their sum to a variable named intSum: a. The fust 50 numbers starting with 1 b. The even numbers beginning at 10 and ending with 100 c The numbers 20, 30, 40, 50, 60, and 70 4. Find the errors in the following For...Next header statements: a. For intCounter = "I" To "19" b. For intNumbcr = 98 To 71 Step 2 c. For intValue = 12 To 52 Step - 4 d. For strCount = - 15 To 5 Step 5Explanation / Answer
2. a) intFieldGoal +=3
b) dblCube ^= 3
c) strDog &= "Treat"
3. a)
#include <stdio.h>
int main()
{
int number=0, intSum=0, count=0;
for(count=0; count<50; count++)
{
if(number%10==1 || number%100==1 || number%1000==1)
{
intSum = intSum+number;
count=count+1;
}
number++;
}
printf("Sum = %d", intSum);
return 0;
}
3. b)
#include <stdio.h>
int main()
{
int number=10, intSum, count=0;
for(number=10; number<=100; number++)
{
if(number%2==0)
{
intSum = intSum+number;
}
}
printf("Sum = %d", intSum);
return 0;
}
3. c)
#include <stdio.h>
int main()
{
int number=20, intSum;
for(number=20; number<=70; number+10)
{
intSum = intSum+number;
}
printf("Sum = %d", intSum);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.