A ))) //Read a string and print it
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char n[20];
printf("Enter your name\n");
scanf("%s",n);
printf("Welcome %s",n);
getch();
}
--------------------------------------------------------------------
Output
Enter your name
IGNOU
Welcome IGNOU
=============================================
B ))) //Print a string 5 times (Using While Loop)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1;
while(i<=5)
{
printf("Hai\n");
i++;
}
getch();
}
C ))) //Print a string n times (Using for Loop)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n;
printf("Enter limit value\n");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
printf("IGNOU\n");
}
getch();
}
B ))) //Print a string 5 times (Using While Loop)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=1;
while(i<=5)
{
printf("Hai\n");
i++;
}
getch();
}
--------------------------------------------------------------------
Output
Hai
Hai
Hai
Hai
Hai
=============================================
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n;
printf("Enter limit value\n");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
printf("IGNOU\n");
}
getch();
}
--------------------------------------------------------------------
Output
Enter limit value
4
IGNOU
IGNOU
IGNOU
IGNOU
No comments:
Post a Comment