1. Write a program to find the summation of the numbers from 5 to 15
Answers
Answered by
0
I assume that the question is asked to find the summation of all the numbers from 5 to 15 using Java programming language.
__________________
public class demo
{
public static void main(String args[])
{
int sum = 0;
int n = 15;
for(int i = 5; i <= n ; i++)
sum += i;
System.out.println("The sum of all natural numbers from 5 to 15 is " +sum);
}
}
_________________
Output of the above program :
The sum of all natural from 5 to 15 is 110
Answered by
0
Answer:
#include <stdio.h>
int main()
{ int i, j, end, isPrime, sum=0;
/* Input upper limit from user */
printf("Find sum of all prime between 1 to : ");
scanf("%d", &end);
/* Find all prime numbers between 1 to end */
for(i=2; i<=end; i++)
{
/* Check if the current number i is Prime or not
Explanation:
Similar questions