Program Source Code
#include"stdio.h"
#include"conio.h"
void main()
{
int a , b , c , i=1;
clrscr();
a=0;
b=1;
printf(“Fibonacci Series”);
printf(“%d\n”, a);
printf(“%d\n”, b);
while(i<=10)
{
c=a+b;
printf(“%d”, c);
a=b;
b=c;
i++;
}
getch();
}
class hello //create class hello { public static void main(String[] args) //main method { System.out.println("\nExample to print HELLO WORLD in Coffee Mug\n"); System.out.println(" _______\n| |\n| |__\n| HELLO" +" | |\n| WORLD | |\n| |__| \n| |\n|_______|"); } }
//String Reverse using strrev function #include"stdio.h" #include"conio.h" #include"string.h" void main() { char str[20]; clrscr(); printf("********* String Reverse Using strrev Function *******\n"); printf("Enter a string: "); gets(str); strrev(str); printf("\n Reverse string is: %s",str); getch(); }Output
//String Reverse without using strrev function #include"stdio.h" #include"conio.h" #include"string.h" void main() { char str1[20],str2[20]; int i,j=0; clrscr(); printf("***********String Reverse*********\n"); printf("Enter String:"); gets(str1); for(i=strlen(str1)-1;i>=0;i--,j++) { str2[j]=str1[i]; } str2[j]=NULL; printf("\nReverse String is:"); puts(str2); getch(); }