Write a complete C program that does the following Every fou
Solution
1.
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=1;i<=7;i++)
{
for(j=1;j<=7;j++)
{
if( i == 4 || j == 4) //if row is 4 or column is 4 print Y else print N
cout<<\"Y\";
else
cout<<\"N\";
}
cout<<endl;
}
return 0;
}
Output:
Success time: 0 memory: 3468 signal:0
2.
#include <iostream>
using namespace std;
int main()
{
int i;
for(i=4;i<=12;i=i+2) //loop to print i and increment its value with 2 until =12
{
cout<<i<<\"\\t\";
}
return 0;
}
output:
Success time: 0 memory: 3468 signal:0
3
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=2;i<=5;i++)
{
for(j=1;j<i;j++) //compare i and j and increment the times of i with j
{
cout<<i;
}
cout<<endl;
}
return 0;
}
output:
Success time: 0 memory: 3468 signal:0
