1. Print Hello World
Code :
#include<stdio.h>
main()
{
printf("Hello World\n");
}
2. Print 1 to 100
Code :
#include<stdio.h>
main()
{
int i;
for(i=1;i<=100;i++)
printf("%d\n",i);
}
3. Print Alphabets from A - Z (Capital)
Code :
#include<stdio.h>
main()
{
char i;
for(i=65;i<=90;i++)
printf("%c\n",i);
}
4. Print Alphabets from a -z (small)
Code :
#include<stdio.h>
main()
{
char i;
for(i=97;i<=122;i++)
printf("%c\n",i);
}
5. To print whether given number is Odd or even
Code :
#include<stdio.h>
main()
{
int i;
scanf("%d",&i);
if(i%2==0)
{
printf("Number is even\n");
}
else
printf("Number is odd\n");
}
0 Comments