C PROGRAMMING
-
write a c program to print address and values of pointer
#include <stdio.h>main() { int a; int *pt; printf("Pointer Example Program : Print Pointer Addressn"); a = 10; pt = &a;…
Read More » -
write a c program to print pyramid pattern of given rows
#include<stdio.h>int main(){ int Rows, i, j, k = 0; printf("Please Enter the Number of Rows: "); scanf("%d", &Rows); printf("Your Pyramid…
Read More » -
write a c program to find area of a circle and circumfrence of a circle
#include<stdio.h>main() { int radius; float PI = 3.14, area, ci; printf("nEnter radius of circle: "); scanf("%d", &radius); area = PI…
Read More » -
write a c progam to reverse a given number using function
#include<stdio.h>#include<conio.h>//REVERSE NUMBER USING FUNCTIONvoid rev(int);void main(){int num;printf("enter any numbern");scanf("%d",&num);rev(num);getch();}void rev(int n){int rev=0,r;while(n!=0){r=n%10;rev=rev*10+r;n=n/10;}printf("reversed number=%d",rev);}
Read More » -
write a c program to reverse a given number
#include <stdio.h>int main() { int n, rev = 0, remainder; printf("Enter an integer: "); scanf("%d", &n); while (n != 0)…
Read More » -
write a c program to concetnate two inputed strings
#include <stdio.h>#include <string.h>main(){ char a[1000], b[1000]; printf("Enter the first stringn"); gets(a); printf("Enter the second stringn"); gets(b); strcat(a, b); printf("String obtained…
Read More » -
write a c program to convert lower case stirng to upper case and upper case string to lower case
#include<stdio.h>#include<string.h>main() { char lower[20] = "aaqib anayat"; char upper[20] = "AAQIB ANAYAT"; printf("String before to strupr : %s n", lower);…
Read More » -
C program to find length of a string
#include <stdio.h>#include <string.h>main(){ char Str[1000]; printf("Enter the String: "); scanf("%s", Str); printf("Length of Str is %ld", strlen(Str));getch(); }
Read More » -
write a c program to check is an entered year a leap year or not
#include <stdio.h>int main(){ int year; printf("Enter a year: n"); scanf("%d", &year); // leap year if perfectly divisible by 400 if…
Read More » -
write a c program to generate mulitplication table of a given number
#include <stdio.h>#include <conio.h>int main(){ int n, i,m,table; printf("Enter a number of which you want to print multiplication table nn"); scanf("%d",&n);…
Read More » -
c program to check is entered number odd or even
#include <stdio.h>#include <conio.h>int main() { int num; printf("Enter a number to check is it even or odd : "); scanf("%d",&num);…
Read More » -
wirte a c program to print factorial of a given number
#include <stdio.h>#include <conio.h>main() { int n, i,factorial=1; printf("Enter any number: "); scanf("%d",&n); for (i=n;i>=1;i--) { factorial = factorial*i; } printf("Factorial…
Read More » -
write a c program to print febonacci series upto a given number
#include <stdio.h>#include <conio.h>int main() { int num1=0,num2=1,i,upto,feb; printf("Enter a number upto which you want print Fibonacci series : "); scanf("%d",&upto);…
Read More » -
write a c program to convert temperature(Celsius to Fahrenheit) and vice verse
#include <stdio.h>main(){ float fh,cl; int choice; printf("n1: Convert temperature from Fahrenheit to Celsius."); printf("n2: Convert temperature from Celsius to Fahrenheit.");…
Read More » -
write a c program to swap two variables using function and pointer (call by reference)
#include<stdio.h> void swap(int *num1, int *num2) { int temp; temp = *num1; *num1 = *num2; *num2 = temp;}main() {…
Read More »