printf - Simple C program not working because of no obvious reason -


i wanted ask following c code, not working , have no idea why. not enter in if statement, when compile in c++ cin , cout instead of printf/scanf works fine.

#include "stdafx.h" #include <conio.h>  int sqrt(int x) {     if(x < 0)      {         return printf("no negative numbers");         return 0;     }      else if(x == 0 || x == 1)      {         return x;     }      else     {         int lowerbound = 1, upperbound = x;         int root = lowerbound + (upperbound - lowerbound)/2;          while(root > x/root || root+1 <= x/(root+1))         {             if(root > x/root)             {                 upperbound = root;             }              else             {                 lowerbound = root;             }             root = lowerbound + (upperbound - lowerbound)/2;         }          if(root*root==x)         {             return root;         }         else         {             return -1;         }     } }  void main() {     int = 0;     int start = 0;     int end = 0;      printf("start , end:  ");     scanf_s("%d%d", &start, &end);      (i = start; < end; i++);     {         if(sqrt(i)>=0)         {             printf("%d",i);             printf("---");         }     }      return; } 

error in line

 (i = start; < end; i++);                               ^   // remove `;` semicolon 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -