C Prog. - ASCII Values, Break, Continue

1,244 views

Published on

Published in: Education, Travel
  • Be the first to comment

C Prog. - ASCII Values, Break, Continue

  1. 1. C Programming –ASCII Values, Break, Continue statement Organized By: Vinay Arora Assistant Professor, CSED Thapar University, Patiala
  2. 2. ASCII Vinay Arora CSED
  3. 3. Data Types (C Program) #include<stdio.h> #include<conio.h> void main() { int a=2; short int b=2; long c=3; long int d=3; unsigned long x=10; unsigned short int y=20; char d1=A; unsigned char d2=B; float m=2.25; double n=6.67; clrscr(); Vinay Arora CSED
  4. 4. Data Types (C Program) contd. printf("For int and Short Int %d t %i",a,b); printf("nFor long and long Int %ld t %ld",c,d); printf("nFor unsigned long and unsigned short Int %u t %u",x,y); printf("nFor char and unsigned char %c %d t %c %d",d1,d1,d2,d2); printf("nFor float and double %f t %lf",x,y); getch(); } Vinay Arora CSED
  5. 5. Data Types (C Program) Output Vinay Arora CSED
  6. 6. Data Types in C Vinay Arora CSED
  7. 7. More on data types (C Program) #include<stdio.h> #include<conio.h> void main() { int a=2; float x=4.0000; clrscr(); printf("%5d",a); printf("n"); printf("%1.3f",x); getch(); } Vinay Arora CSED
  8. 8. More on data types (C Program) Output Vinay Arora CSED
  9. 9. Break Statement #include<stdio.h> #include<conio.h> void main( ) { int i = 1; clrscr(); for(i=1;i<=5;i++) { if(i==3) break; printf("%dn",i); } getch(); } Vinay Arora CSED
  10. 10. Break Statement (output) Vinay Arora CSED
  11. 11. Break Statement #include<stdio.h> #include<conio.h> void main( ) { int j=1; clrscr(); while (j<=10) { if (j==5) break; else printf ("%dn",j); j++; } getch(); } Vinay Arora CSED
  12. 12. Break Statement (output) Vinay Arora CSED
  13. 13. Continue Statement #include<stdio.h> #include<conio.h> void main( ) { int i = 1; clrscr(); for(i=1;i<=5;i++) { if(i==3) continue; printf("%dn",i); } getch(); } Vinay Arora CSED
  14. 14. Continue Statement (output) Vinay Arora CSED
  15. 15. Thnx… Vinay Arora CSED

×