31. Write a Program for Print
1 11 21 31 ---------- 101
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int i;
for(i=1;i<=101;i=i+10)
{
cout<<i<<"\n";
}
getch();
}
1 11 21 31 ---------- 101
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int i;
for(i=1;i<=101;i=i+10)
{
cout<<i<<"\n";
}
getch();
}
...................................................................................................................................................................
32. Write a Program for Print
101 96 91 86 81 - --- --- -- -- 1
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int i;
for(i<101; i>=1; i-5)
{
cout<<i<<"\n";
}
getch();
}
...................................................................................................................................................................
33. Write a Program for print
1 4 9 16 25 36 49 --- ---- -- -- 100
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int i,j;
for(i=1;i<=100;1++)
{
j=i*i;
cout<<j<<"\n";
}
getch();
}
...................................................................................................................................................................
34. Write a Program for print
1 2 4 8 16 32 64 128 256
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int i;
for(i=1;i<256;i*2)
{
cout<<i<<"\n";
}
getch();
}
...................................................................................................................................................................
35. Write a program for print
1 -2 3 -4 5 -6 7 -8 9 -10
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int i;
for(i=1;i<=10;i++)
{
if(i%2==0)
cout<<-i;
else
cout<<i;
}
getch();
}
*********************************************************************************
0 comments:
Post a Comment