Question

1) Use a loop structure to calculate the sum of all odd numbers from 1 to...

1) Use a loop structure to calculate the sum of all odd numbers from 1 to 15

2) Use a loop structure to calculate the product of all odd numbers from 1 to 9.

3) Write a program to convert US dollars to Bangaldeshi taka

Homework Answers

Answer #1

#include<stdio.h>

#include<conio.h>

int main()

{

int i;

int sum=0;

int odd[16];

for(i=0;i<16;i++)

{

odd[i]=i;

}

for(i=0;i<16;i++)

{

if(odd[i]%2!=0)

sum=sum+i;

}

printf("Sum=%d",sum);

return 0;

}//Output :Sum=64

if you are doing coding in Turbo c you can use clrscr():-clear the screen

2)

#include<stdio.h>
#include<conio.h>
int main()
{
int i;
int pro=0;
int odd[10];
for(i=0;i<=9;i++)
{
odd[i]=i;
}
for(i=0;i<;i++)
{
if(odd[i]%2!=0)

pro =pro*i
}
printf("Product=%d",pro);
return 0;
}
//output: pro=945

if you are doing coding in Turbo c you can use clrscr():-clear the screen

3)

#include<stdio.h>

#include<conio.h>

int main()

{

float usd,bdt=0;

printf("Enter the amount in usd");

scanf("%f",&usd);

bdt=usd*84.7727;

printf("%f usd =%f bdt",usd,bdt);

return 0;

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
.Write a for loop to create a list of all the odd numbers between 15 and...
.Write a for loop to create a list of all the odd numbers between 15 and up to and not including 75. Write a second for loop to find the average value in the list, then print it.
Write a program to input a sequence of 8 integers, count all the odd numbers and...
Write a program to input a sequence of 8 integers, count all the odd numbers and sum all the negative integers. One integer is input and processed each time around the loop. Python Programming
The Java program should sum the odd integers from 1 to the integer that the user...
The Java program should sum the odd integers from 1 to the integer that the user enters. For example, if the user enters 30, the program should sum the odd integers from 1 to 30.   Print "Please enter a positive nonzero integer." Declare a Scanner and obtain an integer from the user.   Use a Do...while statement and calculate the sum Use the integer that the obtained from the previous step for the loop-continuation condition. Display the sum Print the sum...
Write a program in MASM (32 bit) that calculates the sum of all odd numbers in...
Write a program in MASM (32 bit) that calculates the sum of all odd numbers in the Fibonacci sequence between 0 and 1,000,000. ***Please Complete in MASM 32 bit!!***
Python code Write a complete program with for loop which calculates the sum of the numbers...
Python code Write a complete program with for loop which calculates the sum of the numbers from 1 to 100
1- Write a program to print only the even numbers from 100 to 200 2- Write...
1- Write a program to print only the even numbers from 100 to 200 2- Write a program to print the odd numbers from 22 – 99 3- Write a program to calculate howe many even number from 10 to 120 1- Write a program to find only the even numbers for 12 different numbers 2- Write a program to find the odd numbers for 10 different numbers 3- Write a program to calculate howe many even number and how...
write a java program to find the sum of natural numbers from 1 to 1000 inclusive...
write a java program to find the sum of natural numbers from 1 to 1000 inclusive (using for loop) sample output: sum=500500
Prompt the user for a positive whole number (call it n) Use a loop to calculate...
Prompt the user for a positive whole number (call it n) Use a loop to calculate the following: Sum: 1+2+...+n Sum of squares: 1^2 + 2^2 + ... + n^2 factorial: 1 x 2 x ... x n Print out the numbers when the loop is done. Do this with a for loop and a while loop. Call the class LoopArithmetic Sample output: The sum from 1 up to 5 is: 15 The sum of squares 1 to 5 is:...
JustPerfects.java (for Loop). In this program, you will use loops to identify perfect numbers (a number...
JustPerfects.java (for Loop). In this program, you will use loops to identify perfect numbers (a number equal to the sum of its divisors - 6 and 28 are the first two! 6 is 2 +3 + 1 and 28 is 14+7+4+2+1). Being the perfect number is quite unique. Only 4 perfect numbers exist between 1 and 10,000 and you’ve already found two! Please write a program to find the additional pair. Bonus: How many perfect numbers exist between 10,000 and...
Uses a while loop to print the numbers from 3 - 19. Uses a do-while loop...
Uses a while loop to print the numbers from 3 - 19. Uses a do-while loop to print the numbers from 42 - 56. Uses a for loop to print the numbers from 87 - 95. Asks the user for 2 numbers. Uses a loop to print all numbers between the given numbers, inclusive. Note: Consider that your user's second number can be lower! (see example below) Note: Also consider that your user might give you two of the same...