Skip to main content

Posts

Showing posts from 2017

Take a 5 Digit Integer Number & Print It in Reverse Order [C Programming]

#include<stdio.h> int main() {     int i, a, b, c, d, e, f, g, h, rev;     printf("Enter a 5 digit integer number: ");     scanf("%d", &i);     a = i/10000;     b = i%10000;     c = b/1000;     d = b%1000;     e = d/100;     f = d%100;     g = f/10;     h = f%10;     rev = h*10000+g*1000+e*100+c*10+a;     printf("Reverse number: %d", rev);     return 0; }

Program That Reads & Sums Data Values Until A Negative Value Is Read [C Programming]

#include<stdio.h> int main() {     int i, sum=0;     while(1)     {         printf("Enter a number: ");         scanf("%d", &i);         if(i>=0)         {             sum += i;         }         else         {             break;         }     }     printf("Sum : %d", sum);     return 0; }

Program to Read The Age of n Persons & Count The Number of Persons Who Are Not in The Age Group 50-60 [C Programming]

#include<stdio.h> int main() {     int i, n, age, count=0;     printf("How many person's age do you want to insert?\n");     scanf("%d", &n);     for(i=1; i<=n; i++)     {         printf("Enter age of person %d: ", i);         scanf("%d", &age);         if(age < 50 || age > 60)         {             count++;         }     }     printf("\nNumber of person(s) who are not in age group 50 - 60 is: %d", count);     return 0; }

Factorial of A Number [C Programming]

#include<stdio.h> int main() {     int i, n, factorial=1;     printf("Enter an integer: ");     scanf("%d", &n);     if(n<0)     {         printf("Factorial of a negative number doesn't exist!");     }     else     {         for(i=1; i<=n; i++)         {             factorial *= i;         }         printf("Factorial of %d is: %d", n, factorial);     }     return 0; }

Classroom Numbers of AIUB [C Programming]

Problem description:  Consider the room numbers of our campus - 423, 432, 441, 234, 534, 132. Here first digit represents campus number, second digit represents floor number and the third number represents room number in that floor. Write a program that will take a three digit number (like 423) and output the Campus, Floor, and Room Number according to the input. INPUT: 423 OUTPUT: Campus 4, Floor 2, Room 3 Code: #include <stdio.h> int main() {     int n, campus, floor, room;     printf("Enter a room number: ");     scanf("%d", &n);     room = n%10;     floor = ((n - room)%100)/10;     campus = n/100;     printf("Campus %d, Floor %d, Room %d", campus, floor, room);     return 0; }

Write A Program That Receives 5 Numbers & Output The Sum & Average of These Numbers [C Programming]

#include <stdio.h> int main() {     float i, n, sum=0, avg;     for(i=0; i<5; i++)     {         printf("Enter a number: ");         scanf("%f", &n);         sum = sum + n;     }     avg = sum / 5;     printf("Sum: %0.2f\n", sum);     printf("Average: %0.2f", avg);     return 0; }

Currency Converter - USD & BDT [C Programming]

#include <stdio.h> void main() {     int i;     float usd, bdt;     printf("Press 1 to convert USD to BDT\nPress 2 to convert BDT to USD\n");     printf("Enter your choice: ");     scanf("%d", &i);     switch(i)     {         case 1:             printf("Enter amount in USD: ");             scanf("%f", &usd);             bdt = usd * 80;             printf("1 USD = 80 BDT\n");             printf("%0.3f USD = %0.3f BDT", usd, bdt);             break;         case 2:   ...

Positive Or Negative Number? [C Programming]

#include <stdio.h> void main() {     int i;     printf("Enter an integer: ");     scanf("%d", &i);     if(i == 0)     {         printf("%d is Zero", i);     }     else if(i>0)     {         printf("%d is Positive", i);     }     else     {         printf("%d is Negative", i);     } }

Odd Or Even Number? [C Programming]

#include <stdio.h> void main() {     int i;     printf("Enter an integer: ");     scanf("%d", &i);     if(i%2 == 0)     {         printf("%d is even", i);     }     else     {         printf("%d is odd", i);     } }

Greater Or Less Than 100? [C Programming]

#include <stdio.h> void main() {     int i;     printf("Enter an integer: ");     scanf("%d", &i);     if(i>100)     {         printf("%d is greater than 100", i);     }     else if(i<100)     {         printf("%d is less than 100", i);     }     else     {         printf("%d is equal to 100", i);     } }

Leap Year [C Programming]

#include <stdio.h> void main() {     int year;     printf("Enter year: ");     scanf("%d", &year);     if((year%4==0 && year%100!=0) || (year%4==0 && year%100==0 && year%400==0))     {         printf("%d is leap year", year);     }     else     {         printf("%d is NOT leap year", year);     } }

Greatest Value Among Three Numbers [C Programming]

#include <stdio.h> void main() {     int a, b, c;     printf("Enter a number in a:");     scanf("%d", &a);     printf("Enter a number in b:");     scanf("%d", &b);     printf("Enter a number in c:");     scanf("%d", &c);     if(a >= b && a >= c) // a > b, a > c     {         printf("%d is largest", a);     }     else if(b >= a && b >= c) // b > a, b > c     {         printf("%d is largest", b);     }     else if(c >= a && c >= b) // c > a, c > b     {         printf("%d is largest", c);     } }

Mark to Letter Grade Converter [C Programming]

#include <stdio.h> void main() {     float a;     printf("Enter marks: ");     scanf("%f", &a);     printf("Grade: ");     if(a >= 90.0) printf("A+");     else if(a >= 80.0) printf("A");     else if(a >= 75.0) printf("B+");     else if(a >= 70.0) printf("B");     else if(a >= 65.0) printf("C+");     else if(a >= 60.0) printf("C");     else if(a >= 55.0) printf("D+");     else if(a >= 50.0) printf("D");     else printf("F"); }

Take Integer, Float, Character as Input & Print Them in Console [C Programming]

#include <stdio.h> void main() {     char ch;     int i;     float f;     printf("Enter a character: ");     scanf("%c", &ch);     printf("Enter an integer: ");     scanf("%d", &i);     printf("Enter a fraction number: ");     scanf("%f", &f);     printf("Character: %c\nInteger: %d\nFloat: %f", ch, i, f); }

Summation, Subtraction, Multiplication, Division [C Programming]

#include<stdio.h> int main() {     float a, b, c;     printf("Enter a number: ");     scanf("%f", &a);     printf("Enter another number: ");     scanf("%f", &b);     c = a + b;     printf("%0.2f + %0.2f = %0.2f\n", a, b, c);     c = a - b;     printf("%0.2f - %0.2f = %0.2f\n", a, b, c);     c = a * b;     printf("%0.2f * %0.2f = %0.2f\n", a, b, c);     c = a / b;     printf("%0.2f / %0.2f = %0.2f\n", a, b, c);     return 0; }

Program to Print Escape Characters [C Programming]

#include <stdio.h> void main( void ) {     printf("Teacher: Do you know programming\?\n"); //\? is used to print ?     printf("Student: No, I\'m not prepared.\n"); //\' is used to print '     printf("Teacher: Check D:\\Programming\\Tutorial for details.\n"); //\\ is used to print     printf("Student: Is the book \"C++ Bible\" good?\n"); //\" is used to print "     printf("Teacher: Yes, it is.\n"); }

Take an input & display it in console [Assembly Language Programming]

.MODEL SMALL .STACK 100H .DATA MSG DB 'Enter a number: $' .CODE MAIN PROC     MOV AX, @DATA       ; initialize DS     MOV DS, AX          LEA DX, MSG             ; load & display MSG     MOV AH, 9     INT 21H          MOV AH, 1                  ; takes input     INT 21H     MOV BL, AL          MOV DL, 0DH              ; display character function     MOV AH, 2                   ; carriage return     INT 21H            ...

5 Google Secret Features You Need To Know

Google has countless secret features that we never knew existed. You can do many interesting things by using these features. Here is 5 of them: #1 Do A Barrel Roll Type "do a barrel roll" in google search box. Click on search icon and see the magic. The whole web page will do a barrel roll!  #2 Zerg Rush Type "zerg rush"  in google search box and click on the search icon. Searching for zerg rush creates a page being eaten by 'O's. If you click on each 'O' three times, it will be vanished. In the end, all the 'O's will create a logo "GG" written on it. #3 Atari Breakout This is the most perfect thing to do when you are bored. You can play game on google image using this feature. To play the game, first go to google image. Then, type "atari breakout" in the search box and hit enter. The game will automatically begin! Play the game and kill your boredom. #4 Flip A Coin Feeling confused abou...

5 Interesting Websites

We often get bored by surfing the same websites everyday like Facebook, Wikipedia, etc. To get rid of the boredom, we may visit some interesting and entertaining websites. Here's the top 5 interesting websites to visit. #1 The Useless Web The Useless Web is really useless but full of entertainment! It redirects a visitor to other useless, funny & interesting websites. This one is a good place to kill boring times. Click on the link to visit useless web: http://www.theuselessweb.com/ #2  Incredibox Incredibox is the most perfect place for music lovers. One can easily create his own sound with a few proper clicks by using this website & become a musician! Click on the link to visit Incredibox: http://www.incredibox.com/ #3 Weave Silk Weave Silk is the best place for people who like to draw because it lets one draw his imagination with mouse cursor in the easiest way. This is the best place to kill boring times by creating amazing creative works of a...