int a=1;int sign= 1; int b=0;
Answers
Answered by
1
Explanation:
#include <stdio.h>
int main()
{
int a =1 ;
int sign =1 ;
int b =0 ;
for( int i=1;i<=4;i++)
{
for(int j =i ;j>= 1;j--)
{
a = a+b;
b++;
printf("%d",a*sign);
sign=sign* -1;
}
printf("\n");
}
}
Output:
1
-24
-711-16
22-2937-46
Similar questions