#include<iostream.h>
void swap(int &a,int &b)
{
int t=a;
a=b;
b=t;
}
void main()
{
int x,y;
cout<<"Enter x ";
cin>>x;
cout<<"Enter y ";
cin>>y;
swap(x,y);
cout<<"X= "<<x<<endl;
cout<<"Y= "<<y;
}
i need this answer
for two positive integers: public static int gcd(int i1, int i2) { // using Euclid's algorithm int a=i1, b=i2, temp; while (b!=0) { temp=b; b=a%temp; a=temp; } return a; }
i love u darling
Java program without mainWe need a main method for executing a program.But YES we can write a program without using main() method.TRICK 1 of 2 :: while writing applets in java we don't use main... we use init() method instead.TRICK 2 of 2 :: using 'static' we can write a program whic will execute successfully and output the desired message on screen. Here it is :: class Mohit{ static { System.out.println("This java program has run without the main method"); System.exit(0); } } -->save the program as Mohit.java to compile::javac Mohit.java (in command prompt) to run ::java Mohit(command prompt) output will be ::This java program has run without the main methodWhoa!!!!! we are done.;)
When you start your xxxx.class it will execute its 'public static void main (String args[])' method. Any other main methods won't be executed, only if your program explicitly calls them.
write a sample program using asp.net explaining all the syntax and semantics of the program
assembly language program for sorting an array using 8086 microprocessor.
write a vb program to find the magic square
Use the following function: int gcd (int a, int b) { while (b != 0) { a %= b; a ^= b ^= a ^= b; } return a; } Note that a ^= b ^= a ^= b is an efficient method of swapping two values.
Write and run a client and a server program in C-language using UDP
5/10
The GCF of consecutive integers is 1.