You are on page 1of 3

Problem_1

=========

#include<stdio.h>
void main()
{
int x=20,y=10;
int z=x+y;
int f=x-y;
int g=x*y;
int h=x/y;
int i=x%y;
printf("value of z is %d",z);
printf("value of f is %d",f);
printf("value of g is %d",g);
printf("value of h is %d",h);
lor3f4rfw4rnfw4jfwr 4noi4gio4f4 w4igi56of4
printf("value of i is %d",i);
}

Output;
=======

value of z is 30value of f is 10value of g is 200value of h is 2value of i is 0

=================================================================================

Problem_2
=========

#include<stdio.h>
int main()
{
int age=20;
if(age>18)
{
printf("person eligible to vote");
}
else
{
printf("person not eligible to vote");
}
}

Output;
=======

person eligible to vote

=================================================================================

Problem-3
=========

#include<stdio.h>
int main()
{
int a=15,b=25;
printf("value of a is %d",a++);
printf("value of b is %d",++b);
printf("value of a is %d",++a);
printf("value of b is %d",b++);
}

Output;
=======

value of a is 15value of b is 26value of a is 17value of b is 26

=================================================================================

Problem-4
=========

#include<stdio.h>
int main()
{
int i=1;
while(i<=10)
{
printf("%d\t",i);
i++;
}
}

Output;
=======

1 2 3 4 5 6 7 8 9 10

==================================================================================

Problem-5
=========

#include<stdio.h>
int main()
{
int i=15;
do
{
printf("%d\t",i);
i++;
}
while(i<15);
}

Output;
=======

15

===================================================================================

Problem-6
=========

#include<stdio.h>
int main()
{
int i;
for(i=0;i<=10;i++)
{
printf("%d\t",i);
}
}

Output;
=======

0 1 2 3 4 5 6 7 8 9 10

===================================================================================

Problem-7
=========

#include<stdio.h>
int main()
{
int g=18;
if(g>15)
if(g==18)
{
printf("value equal to 18");
}
if(g>20)
{
printf("value greater than");
}
else
{
printf("condition not satisfied");
}
}

Output;
=======

value equal to 18condition not satisfied

===================================================================================
=

Problem-8
=========

You might also like