Neeraj Mishra

A crazy computer and programming lover. He spend most of his time in programming, blogging and helping other programming geeks.

C program to raise any number x to a positive power n

#include<stdio.h> #include<conio.h> #include<math.h> void main() { int x,n,result; clrscr(); //to clear the scrren printf(“Enter value of x and n:”); scanf(“%d%d”,&x,&n); result=pow(x,n); printf(“nResult=%d”,result); getch(); //to stop the screen }

C program to print ASCII value of a character

#include<stdio.h> #include<conio.h> void main() { int a; char ch; clrscr(); //to clear the screen printf(“Enter any character:”); scanf(“%c”,&ch); a=ch; printf(“ASCII value of %c is %d”,ch,a); getch(); //to stop the screen }

C program that accepts marks in 5 subjects and outputs average marks

#include<stdio.h> #include<conio.h> void main() { int a,b,c,d,e,average; clrscr(); printf(“Enter marks of subject 1:”); scanf(“%d”,&a); printf(“Enter marks of subject 2:”); scanf(“%d”,&b); printf(“Enter marks of subject 3:”); scanf(“%d”,&c); printf(“Enter marks of subject 4:”); scanf(“%d”,&d); printf(“Enter marks of subject 5:”); scanf(“%d”,&e); average=(a+b+c+d+e)/5; printf(“nAverage=%d”,average); getch(); }

C Program to Add Two Numbers

Here you will get simple C program to add two numbers. User will input two numbers, then their sum will be calculated and finally it will be printed on screen. The program is given below. C Program to Add Two Numbers  #include<stdio.h> int main() { int a,b,sum; printf(“Enter first number:”); scanf(“%d”,&a); printf(“Enter second number:”); scanf(“%d”,&b); …

C Program to Add Two Numbers Read More »

C++ program to print the following design

AABABCABCDABCDE Code:#include<iostream.h>#include<conio.h> void main(){ int i,j,n; char ch; cout<<“How many lines(ex 5):”; cin>>n; for(i=0;i<n;++i) { for(j=0;j<i;++j) { ch=65+j; cout<<ch; } cout<<“n”; } getch();}