C program to find the number of integers divisible by 5 between the given range N1 and N2, where N1 < N2 and are integers. Also find the sum of all these integer numbers that divisible by 5 and output the computed results
by Nideesh C on April 12, 2011 · 0 comments
in C Programming
/* C program to find the number of integers divisible by 5 between the given range N1 and N2, where N1 < N2 and are integers. Also find the sum of all these integer numbers that divisible by 5 and output the computed results */
#include <stdio.h>
#include <conio.h>
void main()
{
int i, N1, N2, count = 0, sum = 0;
clrscr();
printf (“Enter the value of N1 and N2\n”);
scanf (“%d %d”, &N1, &N2);
/*Count the number and compute their sum*/
printf (“Integers divisible by 5 are\n”);
for (i = N1; i < N2; i++)
{
if (i%5 == 0)
{
printf(“%3d,”, i);
count++;
sum = sum + i;
}
}
printf (“\nNumber of integers divisible by 5 between %d and %d = %d\n”,
N1,N2,count);
printf (“Sum of all integers that are divisible by 5 = %d\n”, sum);
} /* End of main()*/
/*—————————–
Output
Enter the value of N1 and N2
2
27
Integers divisible by 5 are
5, 10, 15, 20, 25,
Number of integers divisible by 5 between 2 and 27 = 5
Sum of all integers that are divisible by 5 = 75
——————————————————*/
Not Satisfied ? Just search & get the result
Related posts:
- C program to find the sum of odd numbers and sum of even numbers from 1 to N. Output the computed sums on two different lines with suitable headings
- C program to find the GCD and LCM of two integers output the results along with the given integers. Use Euclids’ algorithm
- Write a C program to find the sum of ‘N’ natural numbers
- C program to generate and print prime numbers in a given range. Also print the number of prime numbers
- Sample – Program to enter three integers and output the biggest integer.
Tagged as:
C program to find the number of integers divisible by 5 between the given range N1 and N2,
integer numbers that divisible by 5 and output the computed results,
where N1 < N2 and are integers. Also find the sum of all these integer numbers that divisible by 5 and output the computed results
Me, freelance system administrator having the qualification of Diploma in Electronics & Tele-communication + MCSE + CCNA + CST + 5 years of experience in IT field.
If you like This post, you can follow TheOnlineTutorials on Twitter.
Contact me Via email: support@theonlinetutorials.com
Subscribe to feed via Feed or EMAIL to receive instant updates.
Legal Disclaimer:All information found on the site is without any implied warranty of fitness for any purpose or use whatsoever. Content author/site administrator is not responsible for any loss occurred due to mistakes in this tutorial. Use this tutorial website at your own risk.