Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Conver it from C Language to COBOL: #include #include int main { int i,sum = 0; printf(Sum = ); // displays Sum = for(i=10;i
Conver it from C Language to COBOL:
#include
#include
int main
{
int i,sum = 0;
printf("Sum = "); // displays Sum =
for(i=10;i<=30;i=i+2) // starting from 10 i increases in steps of 2 (even numbers) till it is equal to 30
{
if(i<30)
printf("%d+",i); // displays even numbers as 10+12+14+....
else
printf("%d",i); // as there should not be + after 30
sum = sum + i; //adds current i value to sum already present,initially sum is 0 then it becomes 10 then 22 so on
}
printf(" Sum = %d",sum); //prints the final value of sum
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started