C Program:
#include<stdio.h> #include<string.h> #include<conio.h> void main() {
Information about resetting and configuring Mobile phones (Java, Android, Symbian etc), educational articles especially for programming in C, C++ and Java and more about Computers and operating systems
#include<stdio.h> #include<string.h> #include<conio.h> void main() {
#include<stdio.h> void main() { int a,b,sum; printf("Enter any two integers: ");
scanf("%d%d",&a,&b); sum = a + ~b + 1; printf("Difference of two integers: %d",sum); }
#include<stdio.h> #include<conio.h> void main() {
#include<stdio.h> void main() {
#include<stdio.h> void main() { int x,y,temp; printf("Enter the value of xand y\n"); scanf("%d%d", &x, &y); printf("Before Swapping\n x= %d\n y = %d\n",x,y); temp = x; x= y; y = temp; printf("After Swapping\n x= %d\ny= %d\n",x,y); }
#include<stdio.h> #include<string.h> #include<conio.h> void main() { char a[100],b[100]; printf("Enter the string to check if palindrome or not\n"); gets(a); strcpy(b,a); strrev(b); if(strcmp(a,b)==0) printf("\nEntered string is palindrome"); else printf("\nEntered string is not palindrome"); getch(); }
#include<string.h> #include<stdio.h> #include<conio.h> void main() { int len,i; char a[100]; printf("Enter the string to check whether it is palindrome or not\n"); gets(a); len=strlen(a); for(i=0;i<len/2;i++) { if(a[i]!=a[len-i-1]) break; } if(i==len/2) printf("\nEntered string is palindrome"); else printf("\nEntered string is not palindrome"); getch(); }
#include<stdio.h> void main() { int n; printf("Enter an integer\n"); scanf("%d",&n); if ( n%2 == 0 ) printf("Even"); else printf("Odd"); }
#include<iostream.h> void main() { int n; cout<<"Enter an integer\n"; cin>>n; if ( n%2 == 0 ) cout<<"\nEven"; else cout <<"\nOdd"; }
#include <stdio.h> void main() { int year; printf("Enter a year to check if it is a leap year\n"); scanf("%d", &year); if(year%400==0 || ((year%4=0) && (year%100!=0))) printf("%d is a leap year.\n", year); else printf("%d is not a leap year.\n", year); }
#include <iostream.h> void main() { int year; cout<<"Enter a year to check if it is a leap year or not"; cin>>year; if(year%400==0 || ((year%4=0) && (year%100!=0))) cout<<"\n"<<year<<"is a leap year."; else cout<<"\n"<<year<<"is NOT a leap year."; }