Introduction to fundamental Data types: Fundamental data types are predefined data types available with C++.There are five fundamental data types in C++: - char - int - float - double - void...
SWAPPING NUMBERS USING 6 METHODS: FIRST METHOD: // C++ program to swap numbers using temporary variable INPUT: #include<iostream> using namespace std; int main() { int x,y,z; cout<<"Enter The Value of x : "; cin>>x; cout<<"Enter The Value of y : "; cin>>y; cout<<"\n\t Before Swapping"<<endl; cout<<"x = "<<x<<endl; cout<<"y = "<<y<<endl; z=x; x=y; y=z; cout<<"\n\t After Swapping"<<endl; cout<<"x = "<<x<<endl; cout<<"y = "<<y<<endl; return 0; } SECOND METHOD: // C++ program to swap numbers without using Temporary variables using addition and subtraction operator INPUT: #include<iostream> using namespace std; int main() { int x,y; ...
//C++ program to print numbers from 1 to 10 INPUT: #include<iostream> using namespace std; int main() { int i; for(i=1;i<=10;i++) { cout<<i<<endl; } return 0; } OUTPUT:
Comments
Post a Comment