Ans 1) Classification of Operators
Ans 1) Classification of Operators
Ans 2) Data types: Definition: Data types are nothing but the storage representation and machine instructions to handle constants differ from machine to machine. 1) Integer 2) Float 3) Character
Case value-1:
Syntax of If-else
if(condition) statement 1;
elseif(condition) statement 2;
elseif(condition) statement 3;
elseif(condition) statement n;
Do { Body of loop; }
While(test condition):
#include<stdio.h> #include<conio.h> main() { int a,b,c; clrscr(); printf("\n Enter any three numbers\n"); scanf("%d%d%d",&a,&b,&c); if(a>b) { if(a>c) printf("\n %d is greater",a); else printf("\n %d is greater",c); } else { if(b>c) printf("\n %d is greater",b); else
#include<stdio.h> #include<conio.h> main() { int marks,avg,sum,d; clrscr(); printf("\n Enter marks of student"); scanf("%d",&marks); if(marks>=75) { printf("\n Distinction"); } else if(marks>=60) { printf("\n First class"); } else if(marks>=50) { printf("\n Second Class");
#include<stdio.h> #include<conio.h> main() { int a,r; clrscr(); printf("\n Enter radius of circle"); scanf("%d",&r); a=3.1415*r*r; printf("\n Area of circle=%d",a); getch(); return 0; }
#include<stdio.h> #include<conio.h> main() { int i; clrscr(); for(i=1;i<=100;i++) if(i%2==0) { printf("\n %d",i); } getch(); return 0; }
4)
#include<stdio.h> #include<conio.h> main() { int a,b,c; clrscr(); printf("\n Enter any three numbers\n"); scanf("%d%d%d",&a,&b,&c); if(a>b) { if(a>c)
printf("\n %d is greater",a); else printf("\n %d is greater",c); } else { if(b>c) printf("\n %d is greater",b); else printf("\n %d is greater",c); } getch(); return 0; }