Sunday, August 8, 2010

C Program to print square of first and last nos of inputted no

/*Program to print square of first and last no of inputted no
  Created by : Malhar Vora
  Created on : 8-8-2010
  Email          : vbmade2000@gmail.com
  WebSite    :  http://malhar2010.blogspot.com
******************************************************************************************************/
#include

void main()
{
      int i=358,a=0,first=0,last=0,flgfirst=0;

    while(i>0)
   {

       a = i%10;

       if(flgfirst==0)
       {
              last=a;
              flgfirst=1;
       }

       first=a;

       i=i/10;
   }

   printf("Square of First no : %d",(first*first));
   printf("\nSquare of Second no : %d",(last*last));

} 

1 comment:

  1. A program that prints itself:
    -------------------------------
    int main(){
    char *p="int main(){ char *p=%c%s%c; printf(p,34,p,34); return 0;}";
    printf(p,34,p,34);
    return 0;
    }

    ReplyDelete