Posts

Showing posts with the label Programming

Programs related to C++ on Code Blocks

Image
Pythonpedia Programs related to C++ on Code Blocks 1.Program to generate Armstrong number? Program:- Pythonpedia Code:- #include <stdio.h> int check_armstrong(int); int power(int, int); int main () {    int c, a, b;    printf("Input two integers\n");    scanf("%d%d", &a, &b);    for (c = a; c <= b; c++) {       if (check_armstrong(c) == 1)          printf("%d\n", c);    }    return 0; } int check_armstrong(int n) {    long long sum = 0, temp;    int remainder, digits = 0;    temp = n;    while (temp != 0) {       digits++;       temp = temp/10;    }    temp = n;    while (temp != 0) {     ...

Programs of Python Based on Class and Objects

Image
Pythonpedia Programs of Python Based on Class and Objects 1.Program to Append, Delete and Display Elements of a List Using Classes? Program:- Pythonpedia Code:- class check():     def __init__(self):         self.n=[]     def add(self,a):         return self.n.append(a)     def remove(self,b):         self.n.remove(b)     def dis(self):         return (self.n) obj=check() choice=1 while choice!=0:     print("0. Exit")     print("1. Add")     print("2. Delete")     print("3. Display")     choice=int(input("Enter choice: "))     if choice==1:         n=int(input("Enter number to append: ")...

Popular posts from this blog

Networking Overview