A ))) //To read 10 nos(do while loop)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a;
do
{
scanf("%d",&a);
i=i+1;
}
while(i<=10);
getch();
}
--------------------------------------------------------
Output
(You can Enter any 10 numbers to read)
===============================================
B ))) //To read 10 nos(For loop )
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a;
printf("Enter 10 nos\n");
for(i=1;i<=10;i=i+1)
{
scanf("%d\n",&a);
}
getch();
}
--------------------------------------------------------
Output
(You can Enter any 10 numbers to read)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a,n;
printf("How many numbers you want to Enter\n");
scanf("%d",&n);
printf("Enter %d numbers\n",n);
while(i<=n)
{
scanf("%d",&a);
i=i+1;
}
getch();
}
------------------------------------------------------------------
Output
How many numbers you want to Enter
3
Enter 3 numbers
3
4
8
===============================================
F ))) //To read n numbers using Arrays
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,a[100];
printf("How many nos you want to read\n");
scanf("%d",&n);
printf("Enter %d nos\n",n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[n]);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a,n;
printf("How many nos you want to enter\n");
scanf("%d",&n);
printf("Enter %d number\n",n);
do
{
scanf("%d",&a);
i=i+1;
}
while(i<=n);
getch();
}
H ))) //Read n numbers(for)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a,n;
printf("Howmany nos you want to enter\n");
scanf("%d",&n);
printf("Enter %d number\n",n);
for(i=1;i<=n;i=i+1)
{
scanf("%d",&a);
}
getch();
}
===============================================
C ))) ////Read 4 numbers(While)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a;
printf("Enter 4 nos\n");
while(i<=4)
{
scanf("%d",&a);
i=i+1;
}
getch();
}
--------------------------------------------------------
Output
(You can Enter any 4 numbers to read)
E )))//To Read n numbers(While Loop)===============================================
D )))
//To read 10 numbers (Using ARRAYS)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,a[10];
printf("Enter 10 nos\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
getch();
}
--------------------------------------------------------
Output
(You can Enter any 10 numbers to read)
===============================================
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a,n;
printf("How many numbers you want to Enter\n");
scanf("%d",&n);
printf("Enter %d numbers\n",n);
while(i<=n)
{
scanf("%d",&a);
i=i+1;
}
getch();
}
------------------------------------------------------------------
Output
How many numbers you want to Enter
3
Enter 3 numbers
3
4
8
===============================================
F ))) //To read n numbers using Arrays
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,a[100];
printf("How many nos you want to read\n");
scanf("%d",&n);
printf("Enter %d nos\n",n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[n]);
}
getch();
}
------------------------------------------------------------------
Output
How many numbers you want to Enter
3
Enter 3 numbers
3
4
8
===============================================
G ))) ////Read n numbers(Do-While)#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a,n;
printf("How many nos you want to enter\n");
scanf("%d",&n);
printf("Enter %d number\n",n);
do
{
scanf("%d",&a);
i=i+1;
}
while(i<=n);
getch();
}
------------------------------------------------------------------
Output
How many numbers you want to Enter
3
Enter 3 numbers
3
4
8
===============================================
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1,a,n;
printf("Howmany nos you want to enter\n");
scanf("%d",&n);
printf("Enter %d number\n",n);
for(i=1;i<=n;i=i+1)
{
scanf("%d",&a);
}
getch();
}
-----------------------------------------------------------------
Output
How many numbers you want to Enter
3
Enter 3 numbers
3
4
8
===============================================
No comments:
Post a Comment