/*
* Debugger.c
*
* Created on: 09.01.2015
* Author: karthik
*/
# include <stdio.h>
# include <stdlib.h>
# define CEILby2(X) ((X+1)/2)
int main()
{
int nCycle,nCount=0;
printf("Understanding of Macros and TypeCasting\n");
printf("Enter the Cycle in even number for a scenario\n");
scanf("%d",&nCycle);
while(nCount <CEILby2(nCycle))
{
nCount++;
}
printf("Number of cycle executed: %d", nCount);
return 0;
}
**************************************
Output:
Understanding of Macros and TypeCasting
Enter the Cycle in even number for a scenario
5
Number of cycle executed:3 ------ expected only 2.
Note: Integer is compared with floating(Real numbers)
* Debugger.c
*
* Created on: 09.01.2015
* Author: karthik
*/
# include <stdio.h>
# include <stdlib.h>
# define CEILby2(X) ((X+1)/2)
int main()
{
int nCycle,nCount=0;
printf("Understanding of Macros and TypeCasting\n");
printf("Enter the Cycle in even number for a scenario\n");
scanf("%d",&nCycle);
while(nCount <CEILby2(nCycle))
{
nCount++;
}
printf("Number of cycle executed: %d", nCount);
return 0;
}
**************************************
Output:
Understanding of Macros and TypeCasting
Enter the Cycle in even number for a scenario
5
Number of cycle executed:3 ------ expected only 2.
Note: Integer is compared with floating(Real numbers)
No comments:
Post a Comment