Computer Science, asked by xevo382, 7 months ago

Write a program to find the sum of the given numbers and print.​

Answers

Answered by kshitijaphapale
0

Answer:

Explanation:

Pictorial Presentation:

Sample Solution:

C Code: #include <stdio.h> void main() { int i,n,sum=0; float avg; printf("Input the 10 numbers : \n"); for (i=1;i<=10;i++) { printf("Number-%d :",i); scanf("%d",&n); sum +=n; } avg=sum/10.0; printf("The sum of 10 no is : %d\nThe Average is : %f\n",sum,avg); } ...

Flowchart:

Answered by manuprajapati519
1

import java.util.Scanner;

public class main

{

public static void main (String args[])

{

Scanner in = new Scanner (System.in);

int a, b, sum;

System.out.println("Write any two numbers");

System.out.print.ln("Please put comma between two number to avoid error");

a = in.nextInt();

b = in.nextInt();

sum = a+b;

System.out.println("The sum of two numbers is..." +sum);

if (a==0&&b==0)

{

System.out.println("Error! Cannot be displayed");

System.exit(0);

}

else if (a==0llb==0)

{

System.out.println("Error! Cannot be displayed");

System.exit(0);

}

}

}

Similar questions