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 program in C that calculate and print the summation of odd numbers between 1-15...
Write a program in C that calculate and print the summation of odd numbers between 1-15 and then find the average of the summation of these numbers, please use double data type to declare all variables. Use for or do/while loop, please explain the steps aswell
.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...
use python Write a program that uses a for loop to display all prime numbers within...
use python Write a program that uses a for loop to display all prime numbers within the range [500, 800] (hint: prime numbers are numbers that have only 2 factors: 1 and themselves. You can use a loop function to check if a number has a factor other than 1 or itself using % operation)
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:...