Write a program to find sum of all integers greater than 100 & less than 200 and are divisible by 5.
Answers
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int i, sum=0;
clrscr();
printf("All nos. between 100 - 200 which is divisible by 5\n");
for(i=101;i<200;i++)
{
if(i%5==0)
{
printf("%5d",i);
sum+=i;
}
}
printf("\n\nsum = %d",sum);
getch();
}
import java.io.*;
class sumfive
{
public static void main(String args[])throws Exception
{
int sum = 0, count = 0;
for (int i = 101; i < 200; i++)
{
if (i % 7 == 0)
{
sum = sum + i;
count++;
}
}
System.out.println("The Sum of the number between 100 to 200 which are divisible by 7 is: "+sum);
System.out.println("Total numbers between 100 to 200 which are divisible by 7 is: "+count);
}
}
Learn more about JAVA programs
https://brainly.in/question/15262300?msp_srt_exp=6
JAVA program
https://brainly.in/question/49648692?msp_srt_exp=6
#SPJ3