Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions decimalToBinary.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <iostream>
using namespace std;

int main(){
int a[10], n, i;
cin >> n;

for(i=0; n>0; i++){
a[i] = n%2;
n = n/2;
}

for(i=i-1 ;i>=0 ;i--){
cout << a[i];
}
}
23 changes: 23 additions & 0 deletions reverseNumber.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include<stdio.h>

int main(){
int num,revNum;

scanf("%d",&num);

revNum = reverse_function(num);
printf("\n%d", revNum);
return 0;
}

int sum = 0, rem;
reverse_function(int num){
if(num){
rem = num%10;
sum = sum*10+rem;
reverse_function(num/10);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are u gona store the return value.
Please add the ss of code execution

}
else
return sum;
return sum;
}