/************************** * author: umang bhatt * * bhatt.umang7@gmail.com * **************************/ /* consider following number 45 * 45 = 2025; 20+25 = 45. Write a program to generate number between 32 and 99 the satisfies the abovce property. */ #include<stdio.h> #define true 0 #define false 1 int foo(int n) { int i = n * n; int j ; int return_val; j = i % 100; i = i / 100; if((i+j)==n) { return_val = true; } else { return_val = false; } return return_val; } void main() { int i ; for( i = 32 ; i <= 99 ; i++) { if(foo(i) == true ) { printf("%d ",i ); } } printf("\n"); }
Saturday, October 1, 2011
number operation
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment