#include
main(){
int i = 0;
int counter = 1;
while(i <= 100){
i = counter*counter;
counter++;
printf("The value of i is:%d\n", i);
}
exit(0);
}
END CODE
I think this should work and display the results in the terminal. I haven't tried it though, so it might not work.
Answer:#includeint main (void) { puts ("1 4 9 16..100"); retun 0; }
#include<stdio.h>
#include<conio.h>
void main()
{
int num[10],i,j,temp;
clrscr();
printf("\n Enter 10 values of an array.....\n");
for(i=0;i<10;i++)
scanf("%d",&num[i]);
printf("\n array before sort ....\n");
for(i=0;i<10;i++)
printf("%d\t",num[i]);
for(i=0;i<9;i++)
{
for(j=i+1;j<10;j++)
{
if(num[i]<num[j])
{
temp=num[i];
num[i]=num[j];
num[j]=temp;
}
}
}
printf("\n array after sort .........\n");
for(i=0;i<10;i++)
printf("%d\t",num[i]);
getch();
}
#include<iostream>
int main()
{
for(int i=1;i<=10;++i)
std::cout<<++i<<std::endl;
return(0);
}
Alternatively:
#include<iostream>
int main()
{
int i=0;
while(i<10)
std::cout<<++i<<std::endl;
return(0);
}
Alternatively:
#include<iostream>
int main()
{
int i=0;
do{
std::cout<<++i<<std::endl;
}while(i<10);
return(0);
}
Alternatively:
#include<iostream>
int main()
{
repeat:
int i=0;
std::cout<<++i<<std::endl;
if(i<10)
goto repeat;
return(0);
}
void main()
{
int i,num=1;
clrscr();
while(num<=100)
{ i=2; while(i<=num)
{ if(num%i==0)
break;
i++; }
if(i==num)
printf("\n%d is Prime",num);
num++;
}
getch();
}
There are many ways to write it. I give you a few example of it. You can follow which will easy for you.
=> Using for loop:
#include <stdio.h>
main(void)
{
int i;
for(i = 1; i <= 10; i++)
{
printf("%d ", i);
}
}
=> Using While loop:
#include <stdio.h>
main(void)
{
int i = 1;
while(i <= 10)
{
printf("%d ", i);
i++;
}
}
=> Using d0-while loop:
#include <stdio.h>
main(void)
{
int i = 1;
do
{
printf("%d ", i);
i++;
} while(i <= 10);
}
#include <iostream>
int main()
{
for( unsigned int i = 1; i < 11; ++i )
{
std::cout << i << std::endl;
}
}
seq 1 2 99
write a program to print the series 1/12+1/22+.........+1/n2 ?
PRINT 2,3,5,7,11,13,17,19,23,29,31,37
printf("1 3 5 7 9\n");
Option explicit Dim val,indx val=inputbox("enter any number") For indx= 1 to 10 print val&"*"&indx&"="&val&"*"indx Next
seq 1 2 99
Write a function that implements an algorithm that checks to see if a particular integer is prime (returning a boolean). Write a program that uses that function on each number from 1 to 100, and if true, displays that number.
we can find the product=230 X70 =16100 cm sq. 1 sq.m =10000 sq.cm. 16100 sq.cm=1.61 m² .
Simply use a for loop (i) that runs from 2 to N-1. Checking if N % i 0 then its a prime number.
write a program to print the series 1/12+1/22+.........+1/n2 ?
PRINT 2,3,5,7,11,13,17,19,23,29,31,37
sum=0 i=1 echo "Enter any number " read num while [ $i -le 10 ] do sum=`expr $num \* $i` i=`expr $i + 1` echo "Table of a number is " $sum done
int first= 1;
printf("1 3 5 7 9\n");
Identification division. Program-id. Prime. Environment division. Data division. Working-storage section. 77 n pic 9(3). 77 q pic 9(3). 77 r pic 9(3). 77 i pic 9(3) value 1. Procedure division. Para-a. Display ( 1 , 1 ) erase. Display ( 2 , 1 ) "enter an integer:". Accept ( 2 , 20 ) n. If n = 1 display ( 3 , 1 ) "number is not prime" go to stop-para. Para-b. Add 1 to i. If i = n display ( 3 , 1 ) "number is prime" go to stop-para. Divide n into i giving q remainder r. If r = 0 display ( 3 , 1 ) "number is not prime" go to stop-para. Go to para-b. Stop-para. Stop run.
nr\m;laeoh9y0m g.qthnedxc In fortran: do i=1,5 write(6,*)i enddo stop end This program will write the numbers 1 to 5 on the screen.
Option explicit Dim val,indx val=inputbox("enter any number") For indx= 1 to 10 print val&"*"&indx&"="&val&"*"indx Next