You are on page 1of 30

#include <stdio.

h>
int main(){
int a=5;
a=printf("Good")+printf("Boy");
printf("%d",a);
return 0;
}

WAP to enter an integer number and


display its equivalent values in octal
and hexadecimal form?

C Introduction

Arithmetic operators program


OPERATION

OUTPUT

A=5%10

A=?

B=5/10

B=?

C=5/2

C=?

D=5.0/2

D=?

E=5.2%2.1

E=?
C Introduction

PROBLEMS:
PRINT FIRST AND LAST DIGIT OF TWO DIGIT
NUMBER???? EX: NUM=24 SPLIT IT AS 2 AND 4
READ DAYS AS INPUT AND FIND HOW MANY
MONTHS AND DAYS???? And Interms of Weeks
and days Ex: 32 days 1 month 2 days ,4 weeks
and 4 days

KP

C Introduction

#include<stdio.h>
int main(){
int a=2,b=7,c=10,d;
c=(a==b);
d=b>a;
printf("%d%d",c,d);
printf(%d,d);
return 0;
}
C Introduction

If operation is TRUE It will return 1 otherwise


0
ExA=20,B=10
OPERATION

VALUE

(A>B) && (B<A)

(A<B)&&(B<A)

(A==B)||(A>B)

10 || 0

???

10 && 20

???

C Introduction

#include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
}

# define infiniteloop while(1)


Main()
{
Infiniteloop;
Printf(PVPSIT);
}

#include <stdio.h>
void main()
{
int x = 0;
if (x == 0)
printf("hi");
else
printf("how are u");
printf("hello");
}

Main()
{
Int x=20;
If(x==20)
Printf(Hello);
Printf(hai);
}

#include <stdio.h>
int x;
void main()
{
if (x)
printf("hi");
else
printf("how are u");
}

Int i;

Main()
{
For(;i<=10;i++);
Printf(I value is %d,i);

Main()
{
Int x=20;//10
If(x==20)
Printf(Hello);
Printf(hai);
}

#include <stdio.h>
void main()
{
double ch;
printf("enter a value btw 1 to 2:");
scanf("%lf", &ch);
switch (ch)
{
case 1:
printf("1");
break;
case 2:
printf("2");
break;
}
}

What will be output of the following


program?

#include<stdio.h>
int main(){
int a=2,b=7,c=10;
c=a==b;
printf("%d",c);
return 0;
}

Main()
{
Int i=22;
If(i=2)
Printf(PVPSIT);
Printf(PVPSIT);
}

WAP to Print the following


series
1 -3 6 -10 15 -21 28 -36 45 -55

WAP to find square of a number


with out using any operator.

WAP to print even or odd without


using control statements.

Three numbers form a Pythagorean triple if


the sum of squares of two numbers is equal to
the square of the third.
For example, 3, 5 and 4 form a Pythagorean
triple, since 3*3 + 4*4 = 25 = 5*5
You are given three integers, a, b, and c. They
need not be given in increasing order. If they
form a Pythagorean triple, then print "yes",
otherwise, print "no".

Printing Right Triangles

You are given a positive integer N. You have to


print N rows as follows. The first row consists
of one 0, the second row 2 zeroes, and so on,
until the Nth row, which consists of N zeroes.

include <stdio.h>
int main() {
int n; int i;
int j;
scanf("%d",&n);
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
printf("0");
} printf("\n");
} return 0; }

#include <conio.h>
#include <stdio.h>
void main()
{
int k=14;
clrscr();
printf("\n integer num is %d",k);
printf("\n octal num is %o",k);
printf("\n hexa num is %X",k);
getch();}

Main()
{int n,I,sum=0,
For(i=1;i<=10;i++)
{ sum+=I;
If(i%2)

Printf(%d,sum);
Else
Printf(%d,-sum);
}
}

Void main()
{
Int a[5]={1,4,9,16,25};
Printf(%d is square is %d ,n,a[n-1]);
}

Void main()
{
int n=6;
Char *name*+=,even,odd-;
Printf(%d is %s number,n,name[n%2]);
}

Main()
{
If(printf(pvpsit))
{
}
}

Main()
{
Int _=10;
Int __=20;
Printf(%d,_+__);
}

Sum of digits,
Palindrome,
Reverse
Armstrong number

You might also like