Find Nth harmonic number using recursion?
Type this into Dev-C++ and run it. You will be able to find whatever harmonic number you want. This may not be perfect because I wrote it in about 10 minutes, but I think it works just fine. Good luck!
#include
double seq(double x);
double seq(double x) {
double temp=0;
if (x==0)
return 0;
return 1/x + seq(x-1);
}
int main() {
double x, y;
while (x != 0) {
printf("Please enter a number:\n");
scanf("%lf", &x);
y = seq(x);
printf("The sequence of that number is: %lf\n", y);
}
system("PAUSE");
return 0;
}
Write in BlueJ to print lucky numbers?
To print lucky numbers in java, you must give the following program:
class example
{
static public void main(String[] args)
{
System.out.println("Lucky number is your favourite number which is your DOB");
}
}
Is assembly language to machine language one to one?
Not quite but very close. If you disassemble a machine code program you do not get the original assembly. Aside from stripping out all comments and variable names, the "structure" of the original assembly is lost. However, if you compare the code side-by-side you will be able to see how similar they actually are and how easy it would be to reverse engineer the code to reproduce a facsimile of the original source code.
A c program to manage a bank system using inheritance and not using the concept of file handling?
using with files
What is call manes for instance?
Call manes are used to protect the delicate skin underneath the Macor. It is a long thin stripe of jellyfied muscle beneath the Amior!
What is the Username of the moshi master?
The moshi monster's master is Mr. Moshi. He is a yellow katsuma with orange stripes.
Add me... friendship248
How to subtract the hexadecimal number 1245 from D257 using two's complement addition method?
You take 1245 and form the two's complement of it then add it to D257.
The two's complement of a number is defined as the 1's complement + 1. In signed two's complement arithmetic, the most significant bit is the "sign" bit. 1 indicates a negative number and 0 indicates a positive number. To find the magnitude of a negative number, take it's two's complement (ignoring carry bits).
To get the two's complement of 1245, take the 1's complement of 1245 and add 1. In binary 1245 is 0001001001000101. The one's complement is 1110110110111010 (in hex that's EDBA) . Adding 1 to this will give you the two's complement. That is EDBA+0001 (ignore the carry if any), is EDBB. Now you add EDBB to D257 and ignore any carry, so that will be 1C012 (throw away the carry bit), C012. C012 is a negative number (the sign bit, the most significant bit, is 1). To find its magnitude, apply the two's complement algorithm above, and you'll find it to be -16365.
Note: D257 is a negative number, and you're subracting a positive number, so you're going to end up with another negative number, i.e. adding the two's complement of a number is the same thing as subtracting the number.
You can check your result by doing the math in decimal to see if it adds up. D257 in decimal = -11688 (you apply the two's complement to the number to find the magnitude, and the sign is negative because the sign bit, the most signficant bit is 1). 1245 in decimal = 4677. -11688-4677 = -16365 (which in hex signed two's complement is C012).
Binary numbers start with a column with the value of 1 on the right side. The next column, to the left, has double the value (which is 2), the next left doubles again (which is 4), then 8, 16, 32, 64, 128 etc. The inclusion of a number 1 in a column means that the number should be included in the total. The inclusion of a zero in a column means that the number should not be counted. Using just this combination of 1s and 0s any number can be represented. For example...
1 = 1
2 = 10
3 = 11
4 = 100
10 = 1010
15 = 1111
65 = 1000001
To convert the numbers from binary to decimal you can simply use a calculator and starting at the right side of the binary number if the first digit is 1 then add 1 to your calculator. If it is zero don't add anything, move left to the next column, if there is a 1 in this column add 2 to your total on your calculator, if it is a zero don't add anything, continue doing this, doubling the value for each column and adding the number if there is a 1 and ignoring it if there is a zero. For example....
The binary number 1100, starting at the right has 0 in the 1 column, 0 in the 2 column, 1 in the 4 column and 1 in the 8 column, so you would ignore 1 and 2 and simply add 4 + 8, giving your a value of 12, which is correct.
What is the algorithm to count no of nodes in singly linked list?
int numNodes = 0;
Node current = root;
// if root is null, the number of nodes is 0
if(current != null) {
// if root is not null, we have at least one node
numNodes = 1;
// count all nodes
while(current .next != null) {
++numNodes;
current = current.next;
}
}
It stands for Public Key Infrastructure. It has to do with security and data encryption.
Parse the character stream from the beginning of the sequence to the end, counting characters as you go. Every time you encounter an opening parenthesis, push the current character count onto the stack. Every time you encounter a closing parenthesis, ensure the stack is not empty before popping the top value from the stack. You can discard the value -- you've found a matching pair.
If you attempt to pop from an empty stack, then you have a closing parenthesis at the current character position that has no matching opening parenthesis.
If you reach the end of the test and the stack is not empty, you have at least one opening parenthesis without a matching closing parenthesis. Pop the character positions off the stack to determine where the opening parenthesis are.
Why data transmission must be encrypted?
Data can be pulled out of the air when you send your friend an email over a wireless internet system and it can be pulled off of a cable when it is sent or someone could break into your computer and steal all your data and you would not even know it was happening..so if someone doesn't want someone else to read there messages or data they encryt it.
What is the difference between fault-tolerant and load-balancing in tibco bisiness works?
Load balancing is done between 2 or more servers where the load is distributed between servers. whereas, fault tolerance is done between 2 servers where one server acts as a primary and the second server acts as a back up server for the primary server. In case of failure of primary server, the second server(back up server) becomes the primary server.
What are the Different types of data type?
Java Data TypesJava is a powerful language that gives us options to have data in different forms. We have several data types that we can use for our needs. The basic data types that java offers us are termed as Primitive Data Types. Though all programming languages have varied data types java offers us with a variety of data types that are much powerful and simplified to use when compared to other languages.
The Java programming language is strongly-typed, which means that all variables must first be declared before they can be used. This involves stating the variable's type and name.
int age = 10;
The above statement tells the java compiler that a field named "age" which holds numeric data and having an initial value of 10 is declared. A variable's data type determines the values it may contain, plus the operations that may be performed on it. In addition to int, the Java programming language supports seven other primitive data types. A primitive type is predefined by the language and is named by a reserved keyword. Primitive values do not share state with other primitive values. The eight primitive data types supported by the Java programming language are: byte, short, int, float, double, long, char and boolean
Write a Multi-user chat server and client?
//Get and display distributed message
#include <sys/types.h> // for type
#include <sys/socket.h> // for socket API
#include <netinet/in.h> // for address
#include <arpa/inet.h> // for sockaddr_in
#include <stdio.h> // for printf()
#include <stdlib.h> // for atoi()
#include <string.h> // for strlen()
#include <unistd.h> // for close()
////////////////////////////////////////////
char *multiHostAddress = "239.255.10.10";
void getEcho (int sock)
{
struct sockaddr_in read_EP;
int stop = -1;
char *msg;
printf ("Waiting for message... \n");
while (stop < 0)
{
msg = (char *)recvfromDST (&read_EP, sock);
if (msg != NULL)
printf ("%s==>%s\n",inet_ntoa(read_EP.sin_addr),msg);
else
stop = 0;
}
}
////////////////////////////////////////////
int main(int argc, char **argv)
{
int sockMulti;
int readPort;
struct sockaddr_in EP_multi;
struct ip_mreq request;
unsigned char TTL=3;
//-------------
int MC_socket;
struct sockaddr_in server_EP, sender_EP;
char msg [60];
char *readmsg;
int port;
int stop = 0;
//--------------
//--------------
if (argc != 4)
{
IO_error(1,"Need host, send port and receive port.(e.g localhost 9000 9001)");
}
//--------------
else
{
//-----------------------------
//Send msg to server
port = atoi (argv[2]);
printf ("TCP Client to send message to Server %s at Port %d \n", argv[1], port);
setHostByName (&server_EP, argv[1], port);
MC_socket= sockTCP_create();
sock_connect(MC_socket, &server_EP);
while (stop 0);
}
//Receive msg from server
readPort = atoi (argv[3]);
printf ("Multicasting receiver at ports %d \n", readPort);
//Initialisation
sockMulti = sockUDP_create();
sockUDP_reuse (sockMulti);
setHostByAddr (&EP_multi, "any", readPort);
sock_bind (sockMulti, readPort);
sockUDP_join (sockMulti, multiHostAddress,&request);
//Use service
getEcho (sockMulti);
//Finalisation
sockUDP_drop (sockMulti, request);
close(sockMulti);
//----------------------------------
}
sock_shutdown(MC_socket, 1);
readmsg = NULL;
while (readmsg != NULL)
readmsg = (char *)readMessage(MC_socket);
//-----------------------------------
}
}
Try running scandisk through again. If that doesn't work, try deleting the file in safe mode (press f8 just before seeing the windows logo when you turn on your computer)
How height of binary search tree effect its performance?
Each level of height adds another layer that you must progress through so it is slower.
What is the difference between data and programs?
Data is the information that a program will act upon. For example, your data might be all of your financial records for the past year, and the program would be some piece of tax software. The program will act upon your data so that the appropriate numbers are placed in the appropriate fields on your tax return.
What universal language was introduced in the 1960's?
The only one that springs to mind is ALGOL 60. It turned out not to be very universal; it was shouldered aside by FORTRAN, COBOL and Dartmouth BASIC.
Orville Wright was born on August 19, 1871 and died on January 30, 1948. Orville Wright would have been 76 years old at the time of death or 143 years old today.
"In a floating point number representation, the number with excess 64 code and base as 16, the number 16e-65 is represented as: "
This the minimum re-presentable positive number.