Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c . 1 6 d . 8 2 . Write a Java Program that asks for an integer N as input and prints the sum

c.16
d.8
2. Write a Java Program that asks for an integer N as input and prints the sum of first N numbers
Marks: 4
\table[[)=(,,Sample Input,Samput Output],[-=,A,6,21],[=-,,10,55]]
Explanation: Sum of first 6 numbers: 1+2+3+4+5+6=21
2
3. What is the output of the following Java code fragment (given that other fragments of the code are correct and so the code will run successfully)?
Marks: 2
int k=832
int m=83210
k=k%10
k=k%1000
k=++k
k=k++
System.out.print ln(m);
System.out.println(k);
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Chemical Engineering Tools For Today And Tomorrow

Authors: Kenneth A. Solen, John N. Harb

5th Edition

0470885726, 978-0470885727

More Books

Students also viewed these Chemical Engineering questions

Question

m Determine whether a fact has changed over time.

Answered: 1 week ago