Tutor profile: Raghuveer S.
Questions
Subject: Computer Science (General)
Binary numbers need more places for counting because A. They are always big numbers B. Any no. of 0's can be added in front of them C. Binary base is small D. 0's and l's have to be properly spaced apart
Answer:C Binary number take more place as the base is 2. Smaller the base larger the space to store the number. For ex: Decimal->255 Binary->11111111 Octal->377 Hexadecimal->FF
Subject: C++ Programming
Print all natural numbers upto N without using semi-colon.
#include<iostream> using namespace std; //Written by Raghuveer Singh int N = 10; int main() { static int x = 1; if (cout << x << " " && x++ < N && main()) { } return 0; }
Subject: C Programming
Write a basic program to check if a given number is palindrome or not without main function?
#include<stdio.h> #define palindrome main //Replaces the palindrome function with main function //Written by Raghuveer Singh int palindrome(){ int num,temp,rev=0; scanf("%d",&num); temp=num; while(temp!=0){ //This loop will store reverse number in rev variable rev=rev*10+temp%10; temp/=10; } if(rev==num) printf("Number is palindrome"); else printf("Numder is not palindrome"); return 0; }
Contact tutor
needs and Raghuveer will reply soon.