Programming World

Befor writing any program you should write suitable header files.

program for accept an integer number and print its square :

       void main()
         {
           int a,squ;
            clrscr();
            printf("\n Enter  any number=")
            scanf("%d",&a);
            sq=a*a;
             printf("\n square of number %d is %d",a,squ);
             getch();

           }

     output :
          Enter any number=5
           square of number 5 is 25



A sample program to display your information :
    void main()
    {
      int rollno;
      char div;
      float per;
      clrscr();
      printf("enter your rollno=")
      scanf("%d",&rollno);
      printf("\n enter div =")
      scanf("%c",&div);
      printf("\n enter percentage=");
       scanf("%f"&per);
      printf("\n rollno=%d"\ndiv=%c\npercentage=%f",rollno,div,per);
      getch();
     }


    output:
       rollno=34
       div= A
       percentage=76%


program for perform addition of two numbers :
        void main()
          {
           int a,b,add;
            clrscr();
            printf("\n enter first number=");
            scanf("%d",a);
            printf("\n enter second number=");
            scanf("%d",b);
            add=a+b;
            printf("\n addition of number %d and %d is %d".,a,b,add);
             getch();
          }

         output :
             enter first number=2
             enter second number=2
             addition of number 2 and 2 is 4.
More option