#include <stdio.h>
int main()
{
int number;
printf("Enter an integer : ");
scanf("%d", &number);
printf("nInteger entered by you : %d", number);
return 0;
}
Output :
Enter an integer : 121
Integer entered by you : 121
Computer Science » C Program » Reverse a Given Number Program : [php]#include<stdio.h> int main() { int num, rem, rev = 0; printf("nEnter any number to be reversed : "); scanf("%d", &num); while (num >= 1) { rem = num % 10; rev = rev * 10 + rem; num = num / 10; } printf("nReversed Number : %d", rev); return (0); }[/php] Output : [php]Enter any number to be reversed : 123 Reversed Number : 321[/php]
Computer Science » C Program » C Program Examples "How to print hello, world! using c program ? How to find area of a circle using c program ? How to find smallest element in an array using c program ? You all must have this kind of questions in your mind. Below article will solve this puzzle of yours. Just take a look.” - Here we have listed all the programs in C programming language, categorised under different progamming concepts like Basic, Area, Mathematical, Number, Array etc. Check the respective category to view all the programs under that category. C Programs - Basic C Programs C Programs - Number Programs C Programs - Area Programs C Programs - Mathematical Programs C Programs - Array Programs C Programs - Electrical Programs C Programs - Pyramid Programs
Computer Science » C Program » Even Number Pyramid Program : [php]#include<stdio.h> int main() { int i, j, num = 2; for (i = 0; i < 4; i++) { num = 2; for (j = 0; j <= i; j++) { printf("%dt", num); num = num + 2; } printf("n"); } return (0); }[/php] Output : [php]2 2 4 2 4 6 2 4 6 8 [/php]
Computer Science » C Program » Inverted Pyramid Program : [php]#include<stdio.h> int main() { int i, j; char ch = '*'; for (i = 4; i >= 0; i--) { printf("n"); for (j = 0; j < i; j++) printf("%c", ch); } return(0); }[/php] Output : [php]**** *** ** *[/php]
Computer Science » C Program » Find sum of Two Integer Numbers Program : [php]#include<stdio.h> int main() { int a, b, sum; printf("Enter the two numbers : "); scanf("%d %d", &a, &b); sum = a + b; printf("nSum of %d and %d is : %d", a,b,sum); return(0); }[/php] Output : [php]Enter the two numbers : 2 4 Sum of 2 and 4 is : 6[/php]