Write a c program to find the number of and sum of all integers greater than 100 and less than 200 that are divisible by a given integer x. 9. Write a c
Answers
Answered by
1
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int i, sum=0,x;
clrscr();
scanf("%d",&x)
printf("All nos. between 100 - 200 which is divisible by %d\n",x);
for(i=101;i<200;i++)
{
if(i%x==0)
{
printf("%5d",i);
sum+=i;
}
}
printf("\n\nsum = %d",sum);
getch();
}
Explanation:
#include<stdio.h>
#include<conio.h>
void main()
{
int i, sum=0,x;
clrscr();
scanf("%d",&x)
printf("All nos. between 100 - 200 which is divisible by %d\n",x);
for(i=101;i<200;i++)
{
if(i%x==0)
{
printf("%5d",i);
sum+=i;
}
}
printf("\n\nsum = %d",sum);
getch();
}
Similar questions
Social Sciences,
5 months ago
Science,
5 months ago
Political Science,
5 months ago
Business Studies,
11 months ago
Chemistry,
1 year ago
Chemistry,
1 year ago
Chemistry,
1 year ago