Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcjęDyskusje Q&A
Can someone explain this code to me....
class ReverseNumberDemo
{ public static void main(String args[]) {
int num=123456789;
int reversenum =0;
while( num != 0 ) {
reversenum = reversenum * 10;
reversenum = reversenum + num%10;
num = num/10; }
System.out.println("Reverse of specified number is: "+reversenum);
}
}
the thing I don't get is the reversenum part......isn't reversenum=0 so wouldn't reversenum*10=0
0 głosów
8 odpowiedziWY I get a rundum number from memory when I run this code
#include <iostream>
using namespace std;
int main ()
{
int array [5];
for (int x = 0; x < 5; x++) {
array [x] = 42;
cout << x << ': ' << array [x] << endl;
}
return 0;
}
if I replace ': ' with ": " every thing works well.
0 głosów
2 odpowiedziPopularne dzisiaj
App doesnt work
3 Votes
Where can I write code for free
1 Votes
Project on HTML and CSS
2 Votes
Code Coach
2 Votes
Tutorial loop
1 Votes
Control Flow<<Time’s Up
0 Votes
Recent update issues?
1 Votes