Lecture4 Ascii Values
Lecture4 Ascii Values
printf("\n X1 = %f “ , );
printf("\n X2 = %f “ , );
}
Differences B/W int and char
int X=5; Char ch=‘5’;
ASCII value (American Standard Code for
Information Interchange)
Definition : - numeric value of character is called the
ASCII value
Note :-
//WAP to display the ASCII value of any char
#include<stdio.h>
void main()
{ char ch;
printf("enter any character");
scanf("%c",&ch);
printf(“\n %c “ , ch ) ;
printf("\n ASCII value = " , );
}
Initialize char in prog.
Enerring char in prog.
#include<stdio.h> #include<stdio.h>
Void main( )
void main() { char ch;
printf("enter any character");
{ char ch = A ; scanf("%c",&ch);
or ------------------
}
char ch = ‘A’ ;
}
Console Window
Note :-
Syntax of if statement-
If ( condition)
{
Statement 1;
Statement 2;
----------------
}
Note:-
Syntax of if-else statement:-
if(condition)
{
Statement 1;
Statement 2;
-----------------
}
else
{
Statement 1;
Statement 2:
----------------
}
#WAP to check no is even or odd
#include<stdio.h>
void main( )
{ int no;
printf ("\n Enter any no");
scanf("%d",&no);
if( )
printf("\n no is even");
else
printf("\n no is odd");
}
#WAP to check no is even or odd
#include<stdio.h>
void main( )
{ int no;
printf ("\n Enter any no");
scanf("%d",&no);
if(no%2)
printf("\n no is odd");
else
printf("\n no is even");
}
Assignment :
# WAP to check year is leap year or not .