CrazyEngineers
  • Solve if u can!!

    Aviskar

    Member

    Updated: Oct 26, 2024
    Views: 1.1K
    Any type of programming problem put here and get many solutions from many CE..
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Aviskar

    MemberJun 2, 2012

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    int a=10;
    if(a=30)
    printf("First");
    else
    printf("Second");
    getch();
    }
    what will be the output??
    Are you sure? This action cannot be undone.
    Cancel
  • Neeraj Sharma

    MemberJun 2, 2012

    I think it would be better if people create separate threads for their own problems. That will be clutter free as when number of pages increase, people care less about seeing the older posts
    Are you sure? This action cannot be undone.
    Cancel
  • Neeraj Sharma

    MemberJun 2, 2012

    Aviskar
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    int a=10;
    if(a=30)
    printf("First");
    else
    printf("Second");
    getch();
    }
    what will be the output??
    Output will be
    First
    as you are not comparing the expression in if so it will always evaluate to true and if part is executed
    Are you sure? This action cannot be undone.
    Cancel
  • Aviskar

    MemberJun 2, 2012

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    int a=10;
    if(a==10);
    printf("First");
    else
    printf("Second");
    getch();
    }
    what will be the output??
    Are you sure? This action cannot be undone.
    Cancel
  • Neeraj Sharma

    MemberJun 2, 2012

    Aviskar
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    int a=10;
    if(a==10);
    printf("First");
    else
    printf("Second");
    getch();
    }
    what will be the output??
    If this program is saved as .C extension then it wont work as in C the declarations must always precede clrscr().
    If this program is saved as .CPP extension then the output will be First
    Are you sure? This action cannot be undone.
    Cancel
  • amitabh1608

    MemberJun 3, 2012

    second
    Are you sure? This action cannot be undone.
    Cancel
  • Neeraj Sharma

    MemberJun 3, 2012

    Oops yeah second is the output if the program is saved with .cpp extension. I didn't notice the semicolon after if. my bad 😛
    Are you sure? This action cannot be undone.
    Cancel
  • amitabh1608

    MemberJun 3, 2012

    garbage value....even 1 if u r using different compilers.
    Are you sure? This action cannot be undone.
    Cancel
  • nareshkumar6539

    MemberJun 3, 2012

    Nick_Sharma
    If this program is saved as .C extension then it wont work as in C the declarations must always precede clrscr().
    If this program is saved as .CPP extension then the output will be First
    Even if you saved as.CPP extension also it will give error as MISPLACED ELSE(else without if)
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register