Untitled
unknown
plain_text
2 years ago
575 B
5
Indexable
#include<iostream> using namespace std; void rev_number(int *number); int sum_of_digits(int number); //playing with address void swap_the_number(int *a,int *b){ int temp=*(a); *(a)=*(b); *(b)=temp; } //call by value int sum_of_digits(int number){ int sum=0; while(number!=0){ int digit=number%10; sum+=digit; number/=10; } return sum; } //main function int main(void){ int a,b; cout<<"Enter the value of a : "; cin>>a; cout<<"Enter the value of b : "; cin>>b; swap_the_number(&a,&b); cout<<"A = "<<a<<" B = "<<b<<endl; }
Editor is loading...