In this post we will teach you how to take input from the user and how to print.
type :-
int a;
cin >> a;
thats how you can input a number in a variable and for output or print :-
You have to type:-
int a=10;
cout <<a ;
lets see a code below :-
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int a;
cin >> a;
cout << a;
return 0;
}
type :-
int a;
cin >> a;
thats how you can input a number in a variable and for output or print :-
You have to type:-
int a=10;
cout <<a ;
lets see a code below :-
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int a;
cin >> a;
cout << a;
return 0;
}
Comments
Post a Comment