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
#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;
}
Get Answers For Free
Most questions answered within 1 hours.