#include<stdio.h>
Search This Blog
Monday, 26 October 2015
Check if a string is a substring of another string in c
#include<stdio.h>
#include<string.h>
#include<string.h>
Thursday, 9 July 2015
C++ program to lag er IDE all the way!
#include < iostream>
int main () {
while (1){
std::cout<< "You are doomed, Qcoders!&$!@#^^%$# Turn the PC off )( *&^% ^%@%# ?>| \a\a\a\a\a\a";
}}
Caution- Use at your own risk, you might need to turn off the computer, lol. Have fun with your friends.
Tags- qcoders, lol, funny, c++, funny c++, caution, funny code, 6 line code, revenge friend, not to, good, have fun.
int main () {
while (1){
std::cout<< "You are doomed, Qcoders!&$!@#^^%$# Turn the PC off )( *&^% ^%@%# ?>| \a\a\a\a\a\a";
}}
Caution- Use at your own risk, you might need to turn off the computer, lol. Have fun with your friends.
Tags- qcoders, lol, funny, c++, funny c++, caution, funny code, 6 line code, revenge friend, not to, good, have fun.
C++ program to check integer whether divisible by 5 or 3.
# include <stdio.h>
int main(){
int number;
printf("Check number divisibility\n");
scanf("%d", &number);
if (number%5 == 0 && number%3 == 0)
printf("\nThe number is divisible by 5 and 3\n");
else if (number%5==0)
printf("\nThe number is divisible by 5\n");
else if (number%3==0)
printf("\nThe number is divisible by 3\n");
else
printf("\nThe number isn't divisible by 3 or 5\n");
return 0;
}
int main(){
int number;
printf("Check number divisibility\n");
scanf("%d", &number);
if (number%5 == 0 && number%3 == 0)
printf("\nThe number is divisible by 5 and 3\n");
else if (number%5==0)
printf("\nThe number is divisible by 5\n");
else if (number%3==0)
printf("\nThe number is divisible by 3\n");
else
printf("\nThe number isn't divisible by 3 or 5\n");
return 0;
}
Input- 5
Output- The number is divisible by 5
Labels- Code, c++, awesome, must, programming, divisible, by 5, by3, qcoders, qcoder, mmhasanovee, good.
Sunday, 5 July 2015
C++ program to take an amount of money & convert into notes.
#include<stdio.h>
#include<math.h>
int main(){
int amt,n1,n2,n3,n4,n5,n6,n7,n8,n9,total;
printf("\n Enter the amount :");
scanf("%d",&amt);
n1=amt/1000;
amt=amt%1000;
n2=amt/500;
amt=amt%500;
n3=amt/100;
amt=amt%100;
n4=amt/50;
amt=amt%50;
n5=amt/20;
amt=amt%20;
n6=amt/10;
amt=amt%10;
n7=amt/5;
amt=amt%5;
n8=amt/2;
n9=amt%2;
total=n1+n2+n3+n4+n5+n6+n7+n8+n9;
printf(" \n Number of notes of 1000 = %d ",n1);
printf(" \n Number of notes of 500 = %d ",n2);
printf(" \n Number of notes of 100 = %d ",n3);
printf(" \n Number of notes of 50 = %d ",n4);
printf(" \n Number of notes of 20 = %d ",n5);
printf(" \n Number of notes of 10 = %d ",n6);
printf(" \n Number of notes of 5 = %d ",n7);
printf(" \n Number of notes of 2 = %d ",n8);
printf(" \n Number of notes of 1 = %d ",n9);
printf(" \n Total number of currency notes = %d ",total);
return 0;
}
labels- money, code, c plus plus, c++, lol, angry, coderus, ovee, mmhasanovee, great, boss, qcoders, coder.
#include<math.h>
int main(){
int amt,n1,n2,n3,n4,n5,n6,n7,n8,n9,total;
printf("\n Enter the amount :");
scanf("%d",&amt);
n1=amt/1000;
amt=amt%1000;
n2=amt/500;
amt=amt%500;
n3=amt/100;
amt=amt%100;
n4=amt/50;
amt=amt%50;
n5=amt/20;
amt=amt%20;
n6=amt/10;
amt=amt%10;
n7=amt/5;
amt=amt%5;
n8=amt/2;
n9=amt%2;
total=n1+n2+n3+n4+n5+n6+n7+n8+n9;
printf(" \n Number of notes of 1000 = %d ",n1);
printf(" \n Number of notes of 500 = %d ",n2);
printf(" \n Number of notes of 100 = %d ",n3);
printf(" \n Number of notes of 50 = %d ",n4);
printf(" \n Number of notes of 20 = %d ",n5);
printf(" \n Number of notes of 10 = %d ",n6);
printf(" \n Number of notes of 5 = %d ",n7);
printf(" \n Number of notes of 2 = %d ",n8);
printf(" \n Number of notes of 1 = %d ",n9);
printf(" \n Total number of currency notes = %d ",total);
return 0;
}
labels- money, code, c plus plus, c++, lol, angry, coderus, ovee, mmhasanovee, great, boss, qcoders, coder.
Thursday, 2 July 2015
C++ program for Leap Year
int main()
{
int year;
printf("Enter a year to check if it is a leap year\n");
scanf("%d", &year);
if ( year%400 == 0)
printf("%d is a leap year.\n", year);
else if ( year%100 == 0)
printf("%d is not a leap year.\n", year);
else if ( year%4 == 0 )
printf("%d is a leap year.\n", year);
else
printf("%d is not a leap year.\n", year);
return 0;
}
Output
Enter a year to check if it is a leap year
2022
2022 is not a leap year.
Monday, 29 June 2015
C++ Program for reversing a number
#include <stdio.h>
int main()
{
int n, reverse = 0;
printf("Enter a number to reverse\n");
scanf_s("%d",&n);
while (n != 0)
{
reverse = reverse * 10;
reverse = reverse + n%10;
n = n/10;
}
printf("Reverse of entered number is = %d\n", reverse);
printf("\n OVeE\n");
return 0;
}
****Input- 56
****Output-65
Tags- Program, input, output, reverse, reverse number, c programming, c++, good, program, learn, ovee, qcoders.blogspot.com
int main()
{
int n, reverse = 0;
printf("Enter a number to reverse\n");
scanf_s("%d",&n);
while (n != 0)
{
reverse = reverse * 10;
reverse = reverse + n%10;
n = n/10;
}
printf("Reverse of entered number is = %d\n", reverse);
printf("\n OVeE\n");
return 0;
}
****Input- 56
****Output-65
Tags- Program, input, output, reverse, reverse number, c programming, c++, good, program, learn, ovee, qcoders.blogspot.com
C++ Program to write a 5 digit number separately
#include <stdio.h>
int main()
{
int d1, d2, d3, d4, d5, number;
printf("Enter a five-digit number: ");
scanf_s("%d", &number);
d5 = number % 10;
d4 = (number / 10) % 10;
d3 = ((number / 10) / 10) % 10;
d2 = (((number / 10) / 10) / 10) % 10;
d1 = ((((number / 10) / 10) / 10) / 10) % 10;
printf(" %d\t", d1);
printf(" %d\t", d2);
printf(" %d\t", d3);
printf(" %d\t", d4);
printf(" %d\t", d5);
printf("\n thanks for using\nOvee\n");
return 0;
}
****Input- 55555
****Output-5 5 5 5 5
Tags- Program, C++, c plus plus, c programming, pc, program, good, covert, number, separate, digit, qcoders, qcoders.blogspot.com
int main()
{
int d1, d2, d3, d4, d5, number;
printf("Enter a five-digit number: ");
scanf_s("%d", &number);
d5 = number % 10;
d4 = (number / 10) % 10;
d3 = ((number / 10) / 10) % 10;
d2 = (((number / 10) / 10) / 10) % 10;
d1 = ((((number / 10) / 10) / 10) / 10) % 10;
printf(" %d\t", d1);
printf(" %d\t", d2);
printf(" %d\t", d3);
printf(" %d\t", d4);
printf(" %d\t", d5);
printf("\n thanks for using\nOvee\n");
return 0;
}
****Input- 55555
****Output-5 5 5 5 5
Tags- Program, C++, c plus plus, c programming, pc, program, good, covert, number, separate, digit, qcoders, qcoders.blogspot.com
Sunday, 28 June 2015
Program to convert Days in Months(nd Days)
#include<stdio.h>
main () { int months, days ; printf("Enter days\n") ; scanf("%d", &days) ; months = days / 30 ; days = days % 30 ; printf("Months = %d Days = %d", months, days) ;
return 0;
}
****Input- 61
****Output- 2 months 1 days
Tags- Program, Qcoders, C++, C plus plus, Days to Months, Converts, Convert, Lol, Programming, Must, Important.
main () { int months, days ; printf("Enter days\n") ; scanf("%d", &days) ; months = days / 30 ; days = days % 30 ; printf("Months = %d Days = %d", months, days) ;
return 0;
}
****Input- 61
****Output- 2 months 1 days
Tags- Program, Qcoders, C++, C plus plus, Days to Months, Converts, Convert, Lol, Programming, Must, Important.
Subscribe to:
Posts (Atom)