Problem Given by Jakir_1.2

#include <stdio.h>
int sq(int x)
{
    return x*x;
}
int main (void)
{
    int i,j;
    for(i=1;i<=5;i++)
    {
       for(j=1;j<=2;j++)
       printf("%d ",sq(i));
       if(i==j)
        {
                j=0;
        }
    }
    system("pause");
    return 0;
}


The output is given below:
     1 1 4 4 9 9 16 16 25 25

0 comments:

Post a Comment