This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.Scanner; | |
public class MixedTypeInput { | |
public static void main(String[] args) { | |
double number; | |
Scanner in = new Scanner(System.in); | |
System.out.println("Enter your gross income: "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetAddress; | |
import java.net.UnknownHostException; | |
public class HostnameExample { | |
public static void main(String[] args) { | |
try { | |
InetAddress address = InetAddress.getLocalHost(); | |
System.out.println("Hostname: " + address.getHostName()); | |
} catch (UnknownHostException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* | |
* Reads in two integer command-line arguments x and y and prints "true" | |
* if both are divisible by 7, and false otherwise. | |
* | |
* a % 7 is the remainder when you divide 7 into a. If the remainder | |
* is 0, then a is divisible by 7. | |
* | |
******************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
printf("Hello"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int intArray[]; //Declaring Array | |
intArray = new int[20]; //Allocating Memory To Array | |
int[] intArray = new int[20]; //Combining Both Statements In One Line | |
int[] intArray = new int[]{ 1,2,3,4,5,6,7,8,9,10 }; //Declaring A Literal Array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scanner sc = new Scanner(System.in); | |
int i = sc.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main() | |
{ | |
int first[20], second[20], c, n; | |
cout << "Enter the number of elements in the array "; | |
cin >> n; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A linked list node | |
struct ListNode | |
{ | |
int val; | |
struct ListNode *next; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Linked list class | |
class ListNode | |
{ | |
// head of list | |
Node head; | |
// Node class | |
class Node | |
{ | |
int val; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Node class | |
class Node: | |
# Function to initialize the node object | |
def __init__(self, v): | |
self.val = v # Assign value | |
self.next = None # Initialize next as null | |
# Linked List class | |
class ListNode: | |
# Function to initialize the Linked List |