Computer Science, asked by vinayprabhas4824, 11 months ago

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 RAHULPATHANAPURAM
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