Women population
in a town, the percentage of men is 52 and the rest are women ( W ).the total population ( T ) of town is given as input.
write a program to print the total number of women in the town.
Input
the first line of input is an integer T .
output
the output should be an integer representing the total number of women in the town.
explanation
given total population 80000 . then the number of women should 80000*48/100=38400
so the output should be 38400 .
sample input 1
80000
sample output 1
38400
sample input 2
100000
sample output 1
48000
from karel.stanfordkarel import *
"""
Your job in the assignment is to add the necessary code to
instruct Karel to walk to the door of its house, pick up the
newspaper (represented by a beeper, of course), and then return
to its initial position in the upper left corner of the house.
"""
def main():
"""
You should write your code to make Karel do its task in
this function. Make sure to delete the 'pass' line before
starting to write your own code. You should also delete this
comment and replace it with a better, more descriptive one.
"""
pass
# There is no need to edit code beyond this point
if __name__ == "__main__":
run_karel_program()
from karel.stanfordkarel import *
"""
Your job in the assignment is to add the necessary code to
instruct Karel to put beeper at the four corner of the room
and return to its original position at bottom left.
"""
def main():
"""
You should write your code to make Karel do its task in
this function. Make sure to delete the 'pass' line before
starting to write your own code. You should also delete this
comment and replace it with a better, more descriptive one.
"""
pass
# There is no need to edit code beyond this point
if __name__ == "__main__":
run_karel_program()
Using the do…while() loop, continuously scan for random integers, but add up only all the positive integers and store the total in one variable.
The loop shall only be terminated when the inputted integer is zero. Afterwards, print out the total of all inputted positive integers.
We Filipinos are quite known for the habit of leaving at least one of the many pieces of food on the plate as it can't be equally divided among all at most times. Just like when 3 people decide to eat a pizza of 10 slices, there will often be at least one slice left on the box. To accurately show just how many pieces of things are left when divided by a certain number, we code it using modulo.
Care to do it for me?
Input
A line containing two integers separated by a space.
10 3
Output
A single line containing an integer.
1
6. Three Lines Apart
by CodeChum Admin
Do you like reading books? If you do, then you must have encountered texts that have quite a wide space with dots in between them, just like pausing or thinking before proceeding the narration. Let's try doing that here in Python, shall we?
Input
Two lines containing a string on each.
some string
another string
Output
The first line contains the first inputted string.
The next three lines contains a dot symbol on each.
The last line contains the second inputted string.
some string
.
.
.
another string
1. Write a program using Java to move the last element of a LL to the beginning of the list.
2. Write a program using Java to find the number of common elements of two linked lists.
e.g. 1à3à5à7ànull
2à3à7à9à11ànull
Output: 2
3. Write a program using Java to reverse the elements of a linked list
4. Write a program using Java to find the middle node of a linked list (ensure that the number of nodes of the LL is an odd number).
5. Write a program to count the number of times a given integer appears in a LL.
6. Preparation for theory-based questions which can be asked during interview.
6.1 Linked List vs 1-d Array
6.2 Comparison of Singly Linked List, doubly linked list and circular Linked list. Advantages and disadvantages of each.
1. Write a Java program to rearrange a given array of unique elements such that every second element of the array is greater than its left and right elements.
Example:
Input :
nums= { 1, 2, 4, 9, 5, 3, 8, 7, 10, 12, 14 }
Output:
Array with every second element is greater than its left and right elements:
[1, 4, 2, 9, 3, 8, 5, 10, 7, 14, 12]
2. Write a Java program to form the largest number from a given list of non-negative integers.
Example:
Input :
nums = {1, 2, 3, 0, 4, 6}
Output:
Largest number using the given array numbers: 643210
3. Write a Java program to shuffle a given array of integers.
4. Write a Java program to find maximum product of two integers in a given array of integers.
Example:
Input :
nums = { 2, 3, 5, 7, -7, 5, 8, -5 }
Output:
Pair is (7, 8), Maximum Product: 56
1. Write a Java program to find the maximum and minimum value of a 1-d array.
2. Write a Java program without using a second array to reverse elements of each row of a 2-d array of integer values.
e.g. 1 2 3 4 4 3 2 1
5 6 7 8 è 8 7 6 5
9 10 11 12 12 11 10 9
3. Write a java program to print the Pascal’s Triangle using a 2-d array.
4. Write a Java program to convert an array to an ArrayList, and an ArrayList to an array.
5. Write a Java program to arrange the elements of a given array of integers where all negative integers appear before all the positive integers.
Identify any 2 categories of information and their characteristics that can aid in social engineering attacks.