fork download
  1. #include<stdio.h>
  2.  
  3. main()
  4. {
  5. int pow(int);
  6. int num=0,j=0,i=0,bin[30]={0},length=30;
  7. printf("Enter Binary no");
  8. while(length>0)
  9. {
  10. scanf("%d",&bin[i]);
  11. i++;
  12. length--;
  13. }
  14. var=i;
  15. while((j<var)&&(i>0))
  16. {
  17. num=num+bin[j]*(pow(i));
  18. j++;
  19. i--;
  20. }
  21. printf("Decimal no is %d\t",num);
  22. }
  23.  
  24. int pow(int num)
  25. {
  26. int temp=0;
  27. while(num>=1)
  28. temp=2*num;
  29. return temp;
  30. }
  31.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:4: warning: return type defaults to ‘int’
prog.c: In function ‘main’:
prog.c:5: warning: conflicting types for built-in function ‘pow’
prog.c:14: error: ‘var’ undeclared (first use in this function)
prog.c:14: error: (Each undeclared identifier is reported only once
prog.c:14: error: for each function it appears in.)
prog.c:10: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
stdout
Standard output is empty