Write a program to print smaller of two number in C
#include<stdio.h>
int main()
{
int x,y;
printf("enter the value of x and y");
scanf("%d %d",&x,&y);
if(x<y)//Relational operator
{
printf("x is Smaller");
}
else
{
printf("y is Smaller");
}
return 0;
}
OUTPUT
enter the value of x and y 5
5
8
x is Smaller
Write a program to print table using while statement
#include<stdio.h>
int main()
{
int n,i=1;
printf("enter any number");
scanf("%d",&n);
while(i<=10) //Relational operator
{
printf("%d * %d = %d \n",n,i,n*i);
i++;
}
return 0;
}
OUTPUT
enter any number25
25* 1 = 25
25 * 2 = 50
25 * 3 = 75
25 * 4 = 100
25 * 5 = 125
25 * 6 = 150
25 * 7 = 175
25 * 8 = 200
25 * 9 = 225
25 * 10 = 250
No comments:
Post a Comment