It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to write a recursive method let's say "printVertical" that takes as input a positive integer and prints its digits in vertical.
For example the output of the call: printVertical(2849) is:
9
4
8
2
Any help guys?
Homework? I'll try to guide you.
1) You can convert the int to a string, and then print the right most char and pass the rest of the string to the next recursive iteration - that probably not the best way
2) Use div & mod by 10, 2849 mod 10 gives 9, print it, pass 2849 div 10 to the next iteration, stop when num div 10 = 0
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I tried to write a groovy script which reads the value from response xml
when value was read it was read in the format [001] but i require that to be read without braces how is it possible?
So, that's a list. Try grabbing the first element
value[ 0 ] as Integer
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to make a counter from 0 to 2.097152 sec with 1 µsec step.
I tried with time.sleep() but this is not the right solution
I use Python 3.x
Thank you for your help
You could have just searched for [python] range float
but anyways:
def msrange(start, stop, step=0.000001):
while start <= stop:
yield round(start, 6)
if start + step > stop:
yield stop
start += step
then you can:
for i in msrange(0, 0.00003):
print(i)
output:
0
1e-06
2e-06
3e-06
...
3e-05
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have googled a lot to know how scanf and printf works.
But did not find any suitable answer.
Please help me.
Let say when we write
scanf("%d", i); // int i
how computer comes to know that the value has been entered from keyboard?
and how printf prints the data or output to the screen?
Please help me
They use the system primitives read and write. You can see more about them here http://comsci.liu.edu/~murali/unix/read.htm and here http://codewiki.wikidot.com/c:system-calls:write and respectively read from stdin(file desc = 0) and stdout(file desc=1).
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
No use perl, python, and similar.
Use printf, a bash builtin: http://mywiki.wooledge.org/BashFAQ/071
If you want the ASCII code of a character in hex:
function ord {
printf %x "'$1"
}
ord A # 41
ord 0 # 30
The use of the single leading quote is explained here:
http://pubs.opengroup.org/onlinepubs/009695399/utilities/printf.html
If the leading character is a single-quote or double-quote, the value shall be
the numeric value in the underlying codeset of the character following the
single-quote or double-quote.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
how do i make all the answers that are "correct" add up in percentage??
i have done the correct and try again....
Assuming that your table looks like this (where 1 means correct and 0 incorrect):
| A
---+-----
1 | 1
2 | 1
3 | 1
4 | 0
You can put the following into A10:
=AVERAGE(A1:A9)
to get the result
0.75