Skip to main content

Posts

Showing posts from November, 2014

simple c program

simple programme to add two numbers # include <stdio.h> #include<conio.h> void main(); { int a,b,sum; printf("Enter any two numbers:\n"); scanf("%d%d",&a,&b); sum=a+b; printf("\nThe sum of two numbers is:%d",sum); getch(); } output Enter any two numbers: _5 _4 The sum of two numbers is:9 /*Here 5,4 and 9 are only examples we will add any two numbers using this programme

c program to display Nepals flag

/*Programme to display Nepali flag*/ # include <stdio.h> #include <stdlib.h> void main() { int i,j; for(i=1;i<=20;i++) { if(i<=8) { for(j=1;j<=8;j++) { if(j==1||i==j&&i<8) printf("* "); else if(i==8&&j>=3) printf("* "); else printf(" "); } } else if(i>8&&i<=12) { for(j=1;j<=7;j++) { if(i==12||j==1||i-j==5) printf("* "); else printf(" "); } } else if(i>12) printf("* "); printf("\n\n\n"); } }

c progrm

Here is the solution of IOE 2070 question 3(b) # include <stdio.h> #include <conio.h> int main() { int i,j; char word[]="pulchowk"; for(i=0;i<8;i++) { for(j=0;j<=i;j++) { if(i==3||i==5||i==7) printf("%c",word[j]-32); else if(i<5) { if(j%2==0) printf("%c",word[j]-32); else printf("%c",word[j]); } else if(j!=0&&j%2==0) printf("%c",word[j]-32); else printf("%c",word[j]); } printf("\n"); } getch(); } output of the programme:- P Pu PuL PULC PuLcH PULCHO puLcHoW PULCHOWK