Draw a flow chart and write an algorithm for a program that multiplies all the three digit odd numbers (Hint: These numbers are 101, 103, …999. You must use looping to multiply them one by one).
Answers
Answered by
1
Answer:
Show ur notebook pls ?????
Explanation:
Divide 5896 by 16 and check the result by division algorithm.
Answered by
0
Flow chart, algorithm and program are given below.
Explanation:
Flow chart:
Refer the attached image for the flow chart.
Algorithm:
- Step 1: Start
- Step 2: Declare i as int
- Step 3: Declare result as unsigned long long int
- Step 4: result = 1
- Step 5: for(i=101;i<=999;i++)
- Step 6: if(i%2!=0)
result=result*i;
- Step 7: Print result
- Step 8: Stop
Program:
#include <stdio.h>
int main()
{
int i;
//As the multiplication result will be long, we use unsigned long long int
data type.
unsigned long long int result;
result=1;
for(i=101;i<=999;i++)
{
if(i%2!=0)
{
result=result*i;
}
}
printf("The multiplication of all the three digit odd numbers from 101 to 999 is equal to %llu. ",result);
return 0;
}
Refer the attached image for output.
Attachments:
Similar questions